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 (StatsdDataFactoryInterface $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 28 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 120 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 467 of file Router.php.

◆ getModule()

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

Definition at line 374 of file Router.php.

◆ getModuleForPath()

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

Definition at line 369 of file Router.php.

◆ getModuleNames()

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

Definition at line 365 of file Router.php.

◆ getPrivateRouteUrl()

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

Definition at line 443 of file Router.php.

◆ getRoutePath()

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

Definition at line 425 of file Router.php.

◆ getRouteUrl()

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

Definition at line 435 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 502 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 518 of file Router.php.

◆ setStats()

MediaWiki\Rest\Router::setStats ( StatsdDataFactoryInterface $stats)
Parameters
StatsdDataFactoryInterface$stats
Returns
self

Definition at line 529 of file Router.php.

◆ substPathParams()

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

Definition at line 457 of file Router.php.


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