|
| __construct (public string readonly string $title='', public string readonly string $description='', public string readonly string $summary='', public array< string > readonly ?array $security=null, public string|null ?string $path=null, null|array|string $method=null, protected parameter[] readonly array $pathtypes=[], protected parameter[] readonly array $queryparams=[], protected parameter[] readonly array $headerparams=[], public null|request_body readonly ?request_body $requestbody=null, protected response[] readonly array $responses=[], public bool readonly bool $deprecated=false, public string[] readonly array $tags=[], public bool readonly bool $cookies=true, public bool readonly bool $abortafterconfig=false, public null|array readonly ?require_login $requirelogin=null, public string[] readonly ?array $scopes=null,... $extra,) |
| Constructor for a new Moodle route.
|
|
| get_header_parameters () |
| Get the list of path parameters, including any from the parent.
|
|
| get_methods (?array $default=null) |
| Get the list of HTTP methods associated with this route.
|
|
| get_path () |
| Get the fully-qualified path for this route relative to root.
|
|
| get_path_parameters () |
| Get the list of path parameters, including any from the parent.
|
|
| get_query_parameters () |
| Get the list of path parameters, including any from the parent.
|
|
| get_request_body () |
| Get the request body for this route.
|
|
| get_response_with_status_code (int $statuscode) |
| Get the response with the specified response code.
|
|
| get_responses () |
| Get all responses.
|
|
| has_any_validatable_parameter () |
| Whether this route expects any validatable parameters.
|
|
| has_request_body () |
| Whether this route expects a request body.
|
|
| set_parent (route $parent) |
| Set the parent route, usually a Class-level route.
|
|
|
string[] null array | $method = null |
| The list of HTTP Methods.
|
|
route null readonly route | $parentroute |
| The parent route, if relevant.
|
|
◆ __construct()
core\router\route::__construct |
( |
public string readonly string | $title = '', |
|
|
public string readonly string | $description = '', |
|
|
public string readonly string | $summary = '', |
|
|
public array< string > readonly ?array | $security = null, |
|
|
public string|null ?string | $path = null, |
|
|
null|array|string | $method = null, |
|
|
protected parameter[]readonly array | $pathtypes = [], |
|
|
protected parameter[]readonly array | $queryparams = [], |
|
|
protected parameter[]readonly array | $headerparams = [], |
|
|
public null|request_body readonly ?request_body | $requestbody = null, |
|
|
protected response[]readonly array | $responses = [], |
|
|
public bool readonly bool | $deprecated = false, |
|
|
public string[]readonly array | $tags = [], |
|
|
public bool readonly bool | $cookies = true, |
|
|
public bool readonly bool | $abortafterconfig = false, |
|
|
public null|array readonly ?require_login | $requirelogin = null, |
|
|
public string[]readonly ?array | $scopes = null, |
|
|
| ... ) |
Constructor for a new Moodle route.
- Parameters
-
string | $title | A title to briefly describe the route (not translated) |
string | $description | A verbose explanation of the operation behavior (not translated) |
string | $summary | A short summary of what the operation does (not translated) |
null | string[] | $security | A list of security mechanisms |
null | string | $path | The path to match |
null | array | string | $method | The method, or methods, supported |
parameter[] | $pathtypes | Validators for the path arguments |
parameter[] | $queryparams | Validators for the path arguments |
parameter[] | $headerparams | Validators for the path arguments |
request_body | null | $requestbody | Validators for the path arguments |
response[] | $responses | A list of possible response types |
bool | $deprecated | Whether this endpoint is deprecated |
string[] | $tags | A list of tags |
bool | $cookies | Whether this request requires cookies |
bool | $abortafterconfig | Whether to abort after configuration |
| mixed[] | ...$extra Any additional arguments not yet supported in this version of Moodle |
- Exceptions
-
- Parameters
-
$title | A title to briefly describe the route (not translated) |
$description | A verbose explanation of the operation behavior (not translated) |
$summary | A short summary of what the operation does (not translated) |
$security | A list of security mechanisms |
$path | The path to the route. |
This is relative to the parent route, if one exists. A route must be set on one, or both, of the class and method level routes.
- Parameters
-
$pathtypes | A list of param types for path arguments |
$queryparams | A list of query parameters with matching types |
$headerparams | A list of header parameters |
$requestbody | A list of parameters found in the body |
$responses | A list of possible response types |
$deprecated | Whether this endpoint is deprecated |
$tags | A list of tags |
$cookies | Whether this request may use cookies |
$abortafterconfig | Whether to abort after configuration |
$requirelogin | Whether to require login or not |
$scopes | The list of scopes required to access this page |
◆ get_header_parameters()
core\router\route::get_header_parameters |
( |
| ) |
|
Get the list of path parameters, including any from the parent.
- Return values
-
◆ get_methods()
core\router\route::get_methods |
( |
?array | $default = null | ) |
|
Get the list of HTTP methods associated with this route.
- Parameters
-
null | string[] | $default | The default methods to use if none are set |
- Return values
-
◆ get_path()
core\router\route::get_path |
( |
| ) |
|
Get the fully-qualified path for this route relative to root.
This includes the path of any parent route.
- Return values
-
◆ get_path_parameters()
core\router\route::get_path_parameters |
( |
| ) |
|
Get the list of path parameters, including any from the parent.
- Return values
-
◆ get_query_parameters()
core\router\route::get_query_parameters |
( |
| ) |
|
Get the list of path parameters, including any from the parent.
- Return values
-
◆ get_request_body()
core\router\route::get_request_body |
( |
| ) |
|
Get the request body for this route.
- Return values
-
◆ get_response_with_status_code()
core\router\route::get_response_with_status_code |
( |
int | $statuscode | ) |
|
Get the response with the specified response code.
- Parameters
-
- Return values
-
◆ get_responses()
core\router\route::get_responses |
( |
| ) |
|
Get all responses.
- Return values
-
◆ has_any_validatable_parameter()
core\router\route::has_any_validatable_parameter |
( |
| ) |
|
Whether this route expects any validatable parameters.
That is, any parameter in the path, query params, or the request body.
- Return values
-
◆ has_request_body()
core\router\route::has_request_body |
( |
| ) |
|
Whether this route expects a request body.
- Return values
-
◆ set_parent()
core\router\route::set_parent |
( |
route | $parent | ) |
|
Set the parent route, usually a Class-level route.
- Parameters
-
- Return values
-
◆ $parentroute
route null readonly route core\router\route::$parentroute |
|
protected |
The parent route, if relevant.
A method-level route may have a class-level route as a parent. The two are combined to provide a fully-qualified path.
The documentation for this class was generated from the following file:
- lib/classes/router/route.php