Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
core\router\schema\parameter Class Reference
Inheritance diagram for core\router\schema\parameter:
core\router\schema\openapi_base core\router\schema\parameters\header_object core\router\schema\parameters\path_parameter core\router\schema\parameters\query_parameter core\router\parameters\header_language core\router\schema\header_object core\router\parameters\path_component core\router\parameters\path_course core\router\parameters\path_themename core\router\parameters\path_user core\router\parameters\query_returnurl

Public Member Functions

 __construct (protected string string $name, protected string string $in, protected string|null ?string $description=null, protected bool|null ?bool $required=null, protected bool|null ?bool $deprecated=false, protected param|null ?param $type=null, protected mixed|null mixed $default=null, protected type_base|null ?type_base $schema=null, protected example|null ?example $example=null, protected example[] array $examples=[],... $extra,)
 Constructor for a Parameter Object.
 
 get_in ()
 Get the OpenAPI 'in' property.
 
 get_name ()
 Get the name of the parameter.
 
 get_openapi_description (specification $api, ?string $path=null,)
 Get the OpenAPI data to include in the OpenAPI specification.
 
 get_openapi_schema (specification $api, ?string $path=null,)
 Get the OpenAPI data to include in the OpenAPI specification.
 
 get_reference (bool $qualify=true,)
 Get the $ref for this class.
 
 get_schema_from_type (param $type)
 Get the schema for a given type.
 
 get_type ()
 Fetch the underlying param.
 
 is_required (route $route)
 Whether this property is required.
 

Static Public Member Functions

static escape_reference (string $reference)
 Escape a reference following rules defined at https://swagger.io/docs/specification/using-ref/.
 
static get_reference_for_class (string $classname, bool $qualify=true,)
 Get the $ref a class name.
 
static get_reference_for_example (string $reference)
 Get the qualified $ref for an example.
 
static get_reference_for_header (string $reference)
 Get the qualified $ref for a parameter.
 
static get_reference_for_parameter (string $reference)
 Get the qualified $ref for a parameter.
 
static get_reference_for_request_body (string $reference)
 Get the qualified $ref for a request body.
 
static get_reference_for_response (string $reference)
 Get the qualified $ref for a response.
 
static get_reference_for_schema (string $reference)
 Get the qualified $ref for a schema.
 

Public Attributes

string const IN_COOKIE = 'cookie'
 A cookie parameter.
 
string const IN_HEADER = 'header'
 A header parameter.
 
string const IN_PATH = 'path'
 A URI path parameter.
 
string const IN_QUERY = 'query'
 A query parameter.
 

Constructor & Destructor Documentation

◆ __construct()

core\router\schema\parameter::__construct ( protected string string $name,
protected string string $in,
protected string|null ?string $description = null,
protected bool|null ?bool $required = null,
protected bool|null ?bool $deprecated = false,
protected param|null ?param $type = null,
protected mixed|null mixed $default = null,
protected type_base|null ?type_base $schema = null,
protected example|null ?example $example = null,
protected example[]array $examples = [],
... )

Constructor for a Parameter Object.

Parameters
string$nameThe name of the parameter. Parameter names are case sensitive.
  • If in is "path", the name field MUST correspond to a template expression occurring within the path field in the Paths Object. See Path Templating for further information.
  • If in is "header" and the name field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
  • For all other cases, the name corresponds to the parameter name used by the in property.
string$inThe location of the parameter. Possible values are "query", "header", "path" or "cookie".
null | string$description
null | bool$required
null | bool$deprecatedSpecifies that a parameter is deprecated and SHOULD be transitioned out of usage.
null | param$typeA Moodle parameter type, which can be used instead of a schema.
mixed$defaultThe default value
null | type_base$schema
null | example$example
example[]$examples
mixed[]...$extra
Exceptions
coding_exception
Parameters
$nameThe name of the parameter. Parameter names are case sensitive
$inThe location of the parameter
$descriptionA description of the parameter
$requiredWhether the parameter is required
$deprecatedWhether the parameter is deprecated
$typeA Moodle parameter type
$defaultThe default value of the parameter
$schemaThe schema
$exampleAn example
$examplesAn array of examples

Member Function Documentation

◆ escape_reference()

static core\router\schema\openapi_base::escape_reference ( string $reference)
staticinherited

Escape a reference following rules defined at https://swagger.io/docs/specification/using-ref/.

Parameters
string$reference
Return values
string

◆ get_in()

core\router\schema\parameter::get_in ( )

Get the OpenAPI 'in' property.

Return values
string

◆ get_name()

core\router\schema\parameter::get_name ( )

Get the name of the parameter.

Return values
string

◆ get_openapi_description()

core\router\schema\parameter::get_openapi_description ( specification $api,
?string $path = null )

Get the OpenAPI data to include in the OpenAPI specification.

Parameters
specification$api
null | string$path
Return values
null|stdClass

Reimplemented from core\router\schema\openapi_base.

Reimplemented in core\router\schema\header_object, core\router\schema\parameters\path_parameter, and core\router\schema\parameters\query_parameter.

◆ get_openapi_schema()

core\router\schema\openapi_base::get_openapi_schema ( specification $api,
?string $path = null )
finalinherited

Get the OpenAPI data to include in the OpenAPI specification.

Parameters
specification$api
null | string$path
Return values
null|stdClass
Exceptions
coding_exception

◆ get_reference()

core\router\schema\openapi_base::get_reference ( bool $qualify = true)
inherited

Get the $ref for this class.

Parameters
bool$qualifyWhether to qualify the reference with the #/components/ part.
Return values
string

◆ get_reference_for_class()

static core\router\schema\openapi_base::get_reference_for_class ( string $classname,
bool $qualify = true )
staticinherited

Get the $ref a class name.

https://swagger.io/docs/specification/using-ref/

Parameters
string$classnameThe class to get a reference for
bool$qualifyWhether to qualify the reference with the #/components/ part
Return values
stringThe reference
Exceptions
coding_exception

◆ get_reference_for_example()

static core\router\schema\openapi_base::get_reference_for_example ( string $reference)
staticinherited

Get the qualified $ref for an example.

Parameters
string$reference
Return values
string

◆ get_reference_for_header()

static core\router\schema\openapi_base::get_reference_for_header ( string $reference)
staticinherited

Get the qualified $ref for a parameter.

Parameters
string$reference
Return values
string

◆ get_reference_for_parameter()

static core\router\schema\openapi_base::get_reference_for_parameter ( string $reference)
staticinherited

Get the qualified $ref for a parameter.

Parameters
string$reference
Return values
string

◆ get_reference_for_request_body()

static core\router\schema\openapi_base::get_reference_for_request_body ( string $reference)
staticinherited

Get the qualified $ref for a request body.

Parameters
string$reference
Return values
string

◆ get_reference_for_response()

static core\router\schema\openapi_base::get_reference_for_response ( string $reference)
staticinherited

Get the qualified $ref for a response.

Parameters
string$reference
Return values
string

◆ get_reference_for_schema()

static core\router\schema\openapi_base::get_reference_for_schema ( string $reference)
staticinherited

Get the qualified $ref for a schema.

Parameters
string$reference
Return values
string

◆ get_schema_from_type()

core\router\schema\openapi_base::get_schema_from_type ( param $type)
inherited

Get the schema for a given type.

Parameters
param$type
Return values
stdClass

◆ get_type()

core\router\schema\parameter::get_type ( )

Fetch the underlying param.

Return values
param

◆ is_required()

core\router\schema\parameter::is_required ( route $route)

Whether this property is required.

Parameters
route$route
Return values
bool

Reimplemented in core\router\schema\parameters\path_parameter.


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