Added new "is_route" helper method

This commit is contained in:
Alex Tselegidis 2021-12-17 08:45:28 +01:00
parent 775d385e09
commit bfef58672c
1 changed files with 16 additions and 0 deletions

View File

@ -29,3 +29,19 @@ if ( ! function_exists('route_api_resource'))
$route[$prefix . $resource . '/(:num)']['get'] = 'api/v1/' . $resource . '_api_v1/show/$1'; $route[$prefix . $resource . '/(:num)']['get'] = 'api/v1/' . $resource . '_api_v1/show/$1';
} }
} }
if ( ! function_exists('is_route'))
{
/**
* Check whether the current request matches the provided routed URI.
*
* @param string $uri Routed URI (as in controller/method).
*/
function is_route(string $uri): bool
{
/** @var EA_Controller $CI */
$CI =& get_instance();
return $CI->uri->ruri_string() === $uri;
}
}