Moodle PHP Documentation 5.0
Moodle 5.0.1+ (Build: 20250711) (61af040cd5f)
FastRoute\RouteCollector Class Reference

Public Member Functions

 __construct (RouteParser $routeParser, DataGenerator $dataGenerator)
 Constructs a route collector.
 
 addGroup ($prefix, callable $callback)
 Create a route group with a common prefix.
 
 addRoute ($httpMethod, $route, $handler)
 Adds a route to the collection.
 
 delete ($route, $handler)
 Adds a DELETE route to the collection.
 
 get ($route, $handler)
 Adds a GET route to the collection.
 
 getData ()
 Returns the collected route data, as provided by the data generator.
 
 head ($route, $handler)
 Adds a HEAD route to the collection.
 
 patch ($route, $handler)
 Adds a PATCH route to the collection.
 
 post ($route, $handler)
 Adds a POST route to the collection.
 
 put ($route, $handler)
 Adds a PUT route to the collection.
 

Protected Attributes

string $currentGroupPrefix
 
DataGenerator $dataGenerator
 
RouteParser file home runner work phpdoc phpdoc moodle lib nikic fast route src RouteCollector php $routeParser
 

Constructor & Destructor Documentation

◆ __construct()

FastRoute\RouteCollector::__construct ( RouteParser $routeParser,
DataGenerator $dataGenerator )

Constructs a route collector.

Parameters
RouteParser$routeParser
DataGenerator$dataGenerator

Member Function Documentation

◆ addGroup()

FastRoute\RouteCollector::addGroup ( $prefix,
callable $callback )

Create a route group with a common prefix.

All routes created in the passed callback will have the given group prefix prepended.

Parameters
string$prefix
callable$callback

◆ addRoute()

FastRoute\RouteCollector::addRoute ( $httpMethod,
$route,
$handler )

Adds a route to the collection.

The syntax used in the $route string depends on the used route parser.

Parameters
string | string[]$httpMethod
string$route
mixed$handler

◆ delete()

FastRoute\RouteCollector::delete ( $route,
$handler )

Adds a DELETE route to the collection.

This is simply an alias of $this->addRoute('DELETE', $route, $handler)

Parameters
string$route
mixed$handler

◆ get()

FastRoute\RouteCollector::get ( $route,
$handler )

Adds a GET route to the collection.

This is simply an alias of $this->addRoute('GET', $route, $handler)

Parameters
string$route
mixed$handler

◆ getData()

FastRoute\RouteCollector::getData ( )

Returns the collected route data, as provided by the data generator.

Return values
array

◆ head()

FastRoute\RouteCollector::head ( $route,
$handler )

Adds a HEAD route to the collection.

This is simply an alias of $this->addRoute('HEAD', $route, $handler)

Parameters
string$route
mixed$handler

◆ patch()

FastRoute\RouteCollector::patch ( $route,
$handler )

Adds a PATCH route to the collection.

This is simply an alias of $this->addRoute('PATCH', $route, $handler)

Parameters
string$route
mixed$handler

◆ post()

FastRoute\RouteCollector::post ( $route,
$handler )

Adds a POST route to the collection.

This is simply an alias of $this->addRoute('POST', $route, $handler)

Parameters
string$route
mixed$handler

◆ put()

FastRoute\RouteCollector::put ( $route,
$handler )

Adds a PUT route to the collection.

This is simply an alias of $this->addRoute('PUT', $route, $handler)

Parameters
string$route
mixed$handler

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