MediaWiki master
MediaWiki\Rest\Router Class Reference

The REST router is responsible for gathering module configuration, matching an input path against the defined modules, and constructing and executing the relevant module for a request. More...

Public Member Functions

 __construct (array $routeFiles, array $extraRoutes, ServiceOptions $options, BagOStuff $cacheBag, ResponseFactory $responseFactory, BasicAuthorizerInterface $basicAuth, Authority $authority, ObjectFactory $objectFactory, Validator $restValidator, ErrorReporter $errorReporter, HookContainer $hookContainer, Session $session)
 
 execute (RequestInterface $request)
 
 getModule (string $name)
 
 getModuleForPath (string $fullPath)
 
 getModuleNames ()
 
 getPrivateRouteUrl (string $routeWithModulePrefix, array $pathParams=[], array $queryParams=[])
 
 getRoutePath (string $routeWithModulePrefix, array $pathParams=[], array $queryParams=[])
 
 getRouteUrl (string $routeWithModulePrefix, array $pathParams=[], array $queryParams=[])
 
 prepareHandler (Handler $handler)
 Prepare the handler by injecting relevant service objects and state into $handler.
 
 setCors (CorsUtils $cors)
 
 setStats (StatsFactory $stats)
 

Protected Member Functions

 substPathParams (string $route, array $pathParams)
 

Detailed Description

The REST router is responsible for gathering module configuration, matching an input path against the defined modules, and constructing and executing the relevant module for a request.

Definition at line 29 of file Router.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Router::__construct ( array $routeFiles,
array $extraRoutes,
ServiceOptions $options,
BagOStuff $cacheBag,
ResponseFactory $responseFactory,
BasicAuthorizerInterface $basicAuth,
Authority $authority,
ObjectFactory $objectFactory,
Validator $restValidator,
ErrorReporter $errorReporter,
HookContainer $hookContainer,
Session $session )
Parameters
string[]$routeFiles
array[]$extraRoutes
ServiceOptions$options
BagOStuff$cacheBagA cache in which to store the matcher trees
ResponseFactory$responseFactory
BasicAuthorizerInterface$basicAuth
Authority$authority
ObjectFactory$objectFactory
Validator$restValidator
ErrorReporter$errorReporter
HookContainer$hookContainer
Session$session
Access: internal

Definition at line 104 of file Router.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions(), MediaWiki\MainConfigNames\CanonicalServer, MediaWiki\Config\ServiceOptions\get(), MediaWiki\MainConfigNames\InternalServer, MediaWiki\MainConfigNames\RestPath, and MediaWiki\MainConfigNames\ScriptPath.

Member Function Documentation

◆ execute()

MediaWiki\Rest\Router::execute ( RequestInterface $request)

Definition at line 443 of file Router.php.

◆ getModule()

MediaWiki\Rest\Router::getModule ( string $name)

Definition at line 360 of file Router.php.

◆ getModuleForPath()

MediaWiki\Rest\Router::getModuleForPath ( string $fullPath)

Definition at line 355 of file Router.php.

◆ getModuleNames()

MediaWiki\Rest\Router::getModuleNames ( )
Returns
string[]

Definition at line 351 of file Router.php.

◆ getPrivateRouteUrl()

MediaWiki\Rest\Router::getPrivateRouteUrl ( string $routeWithModulePrefix,
array $pathParams = [],
array $queryParams = [] )

Definition at line 419 of file Router.php.

◆ getRoutePath()

MediaWiki\Rest\Router::getRoutePath ( string $routeWithModulePrefix,
array $pathParams = [],
array $queryParams = [] )
Since
1.42

Definition at line 401 of file Router.php.

◆ getRouteUrl()

MediaWiki\Rest\Router::getRouteUrl ( string $routeWithModulePrefix,
array $pathParams = [],
array $queryParams = [] )

Definition at line 411 of file Router.php.

◆ prepareHandler()

MediaWiki\Rest\Router::prepareHandler ( Handler $handler)

Prepare the handler by injecting relevant service objects and state into $handler.

Access: internal

Definition at line 486 of file Router.php.

References MediaWiki\Rest\Handler\initServices(), and MediaWiki\Rest\Handler\initSession().

◆ setCors()

MediaWiki\Rest\Router::setCors ( CorsUtils $cors)
Parameters
CorsUtils$cors
Returns
self

Definition at line 502 of file Router.php.

◆ setStats()

MediaWiki\Rest\Router::setStats ( StatsFactory $stats)
Access: internal
Parameters
StatsFactory$stats
Returns
self

Definition at line 515 of file Router.php.

◆ substPathParams()

MediaWiki\Rest\Router::substPathParams ( string $route,
array $pathParams )
protected
Parameters
string$route
array$pathParams
Returns
string

Definition at line 433 of file Router.php.


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