Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
core\router\util Class Reference

Static Public Member Functions

static get_path_for_callable (string|array|callable $callable, array $params=[], array $queryparams=[],)
 Get the URI path for the specified callable.
 
static get_route_instance_for_method (callable|array|string $callable)
 Get the instance of the core\router\route attribute for the specified callable if one is available.
 
static get_route_instance_for_request (ServerRequestInterface $request)
 Get the route attribute for the specified request.
 
static get_route_name_for_callable (callable|array|string $callable,)
 Get the route name for the specified callable.
 
static normalise_component_path (string $component,)
 Normalise the component for use as part of the path.
 
static redirect (ResponseInterface $response, string|url $url,)
 Redirect to a URL.
 
static redirect_to_callable (ServerRequestInterface $request, ResponseInterface $response, array|callable|string $callable, ?array $pathparams=null, ?array $queryparams=null, ?array $excludeparams=null,)
 Redirect to the requested callable.
 
static redirect_with_params (string|url $path, array $excludeparams=[],)
 Redirect to the specified URL, carrying all parameters across too.
 
static throw_page_not_found (ServerRequestInterface $request, ResponseInterface $response,)
 Generate a Page Not Found result.
 

Member Function Documentation

◆ get_path_for_callable()

static core\router\util::get_path_for_callable ( string|array|callable $callable,
array $params = [],
array $queryparams = [] )
static

Get the URI path for the specified callable.

Parameters
string | array | callable$callablethe Callable to get the URI for
array$paramsAny parameters to include in the path
array$queryparamsAny parameters to include in the query string
Return values
url

◆ get_route_instance_for_method()

static core\router\util::get_route_instance_for_method ( callable|array|string $callable)
static

Get the instance of the core\router\route attribute for the specified callable if one is available.

Parameters
callable | array | string$callable
Return values
null|routeThe route if one was found.

◆ get_route_instance_for_request()

static core\router\util::get_route_instance_for_request ( ServerRequestInterface $request)
static

Get the route attribute for the specified request.

Parameters
ServerRequestInterface$request
Return values
null|route

◆ get_route_name_for_callable()

static core\router\util::get_route_name_for_callable ( callable|array|string $callable)
static

Get the route name for the specified callable.

Parameters
callable | array | string$callable
Return values
string
Exceptions
coding_exceptionIf the callable could not be resolved into an Array format

◆ normalise_component_path()

static core\router\util::normalise_component_path ( string $component)
static

Normalise the component for use as part of the path.

If the component is a subsystem, the core_ prefix will be removed. If the component is 'core', it will be kept. All other components will use their frankenstyle name.

Parameters
string$component
Return values
string

◆ redirect()

static core\router\util::redirect ( ResponseInterface $response,
string|url $url )
static

Redirect to a URL.

Parameters
ResponseInterface$response
string | url$url
Return values
ResponseInterface

◆ redirect_to_callable()

static core\router\util::redirect_to_callable ( ServerRequestInterface $request,
ResponseInterface $response,
array|callable|string $callable,
?array $pathparams = null,
?array $queryparams = null,
?array $excludeparams = null )
static

Redirect to the requested callable.

Parameters
ServerRequestInterface$request
ResponseInterface$response
array | callable | string$callable
null | array$pathparams
null | array$queryparams
null | array$excludeparamsA list of any parameters to remove the URI during the redirect
Return values
ResponseInterface

◆ redirect_with_params()

static core\router\util::redirect_with_params ( string|url $path,
array $excludeparams = [] )
static

Redirect to the specified URL, carrying all parameters across too.

Parameters
string | url$path
array$excludeparamsAny parameters to exclude from the query params @codeCoverageIgnore

◆ throw_page_not_found()

static core\router\util::throw_page_not_found ( ServerRequestInterface $request,
ResponseInterface $response )
static

Generate a Page Not Found result.

Parameters
ServerRequestInterface$request
ResponseInterface$response
Return values
ResponseInterface
Exceptions
Slim\Exception\HttpNotFoundException

The documentation for this class was generated from the following file: