Rename is_route helper functiont to is_callback

This commit is contained in:
Alex Tselegidis 2021-12-17 10:36:47 +01:00
parent 6c4a15b429
commit bd363d0725
1 changed files with 8 additions and 5 deletions

View File

@ -30,18 +30,21 @@ if ( ! function_exists('route_api_resource'))
} }
} }
if ( ! function_exists('is_route')) if ( ! function_exists('is_callback'))
{ {
/** /**
* Check whether the current request matches the provided routed URI. * Check whether the current request matches the provided controller/method callback.
* *
* @param string $uri Routed URI (as in controller/method). * @param string $class Controller class name.
* @param string $method Controller method name.
*
* @return bool
*/ */
function is_route(string $uri): bool function is_callback(string $class, string $method): bool
{ {
/** @var EA_Controller $CI */ /** @var EA_Controller $CI */
$CI =& get_instance(); $CI =& get_instance();
return $CI->uri->ruri_string() === $uri; return $CI->router->class === $class && $CI->router->method === $method;
} }
} }