mediatekformation

Route
in package
implements Serializable

A Route describes a route and its parameters.

Tags
author

Fabien Potencier fabien@symfony.com

author

Tobias Schultze http://tobion.de

Interfaces, Classes, Traits and Enums

Serializable

Table of Contents

$compiled  : CompiledRoute|null
$condition  : mixed
$defaults  : mixed
$host  : mixed
$methods  : mixed
$options  : mixed
$path  : mixed
$requirements  : mixed
$schemes  : mixed
__construct()  : mixed
Constructor.
__serialize()  : array<string|int, mixed>
__unserialize()  : void
addDefaults()  : $this
addOptions()  : $this
addRequirements()  : $this
compile()  : CompiledRoute
Compiles the route.
getCondition()  : string
getDefault()  : mixed
getDefaults()  : array<string|int, mixed>
getHost()  : string
getMethods()  : array<string|int, string>
Returns the uppercased HTTP methods this route is restricted to.
getOption()  : mixed
Returns the option value or null when not found.
getOptions()  : array<string|int, mixed>
getPath()  : string
getRequirement()  : string|null
getRequirements()  : array<string|int, mixed>
getSchemes()  : array<string|int, string>
Returns the lowercased schemes this route is restricted to.
hasDefault()  : bool
hasOption()  : bool
hasRequirement()  : bool
hasScheme()  : bool
Checks if a scheme requirement has been set.
setCondition()  : $this
setDefault()  : $this
Sets a default value.
setDefaults()  : $this
setHost()  : $this
setMethods()  : $this
Sets the HTTP methods (e.g. 'POST') this route is restricted to.
setOption()  : $this
Sets an option value.
setOptions()  : $this
setPath()  : $this
setRequirement()  : $this
setRequirements()  : $this
setSchemes()  : $this
Sets the schemes (e.g. 'https') this route is restricted to.
extractInlineDefaultsAndRequirements()  : string
isLocalized()  : bool
sanitizeRequirement()  : mixed

Properties

$condition

private mixed $condition = ''

$defaults

private mixed $defaults = []

$host

private mixed $host = ''

$methods

private mixed $methods = []

$options

private mixed $options = []

$path

private mixed $path = '/'

$requirements

private mixed $requirements = []

$schemes

private mixed $schemes = []

Methods

__construct()

Constructor.

public __construct(string $path[, array<string|int, mixed> $defaults = [] ][, array<string|int, mixed> $requirements = [] ][, array<string|int, mixed> $options = [] ][, string|null $host = '' ][, string|array<string|int, string> $schemes = [] ][, string|array<string|int, string> $methods = [] ][, string|null $condition = '' ]) : mixed

Available options:

  • compiler_class: A class name able to compile this route instance (RouteCompiler by default)
  • utf8: Whether UTF-8 matching is enforced ot not
Parameters
$path : string

The path pattern to match

$defaults : array<string|int, mixed> = []

An array of default parameter values

$requirements : array<string|int, mixed> = []

An array of requirements for parameters (regexes)

$options : array<string|int, mixed> = []

An array of options

$host : string|null = ''

The host pattern to match

$schemes : string|array<string|int, string> = []

A required URI scheme or an array of restricted schemes

$methods : string|array<string|int, string> = []

A required HTTP method or an array of restricted methods

$condition : string|null = ''

A condition that should evaluate to true for the route to match

Return values
mixed —

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —

__unserialize()

public __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Return values
void —

addDefaults()

public addDefaults(array<string|int, mixed> $defaults) : $this
Parameters
$defaults : array<string|int, mixed>
Return values
$this —

addOptions()

public addOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>
Return values
$this —

addRequirements()

public addRequirements(array<string|int, mixed> $requirements) : $this
Parameters
$requirements : array<string|int, mixed>
Return values
$this —

compile()

Compiles the route.

public compile() : CompiledRoute
Tags
throws
LogicException

If the Route cannot be compiled because the path or host pattern is invalid

see
RouteCompiler

which is responsible for the compilation process

Return values
CompiledRoute —

getCondition()

public getCondition() : string
Return values
string —

getDefault()

public getDefault(string $name) : mixed
Parameters
$name : string
Return values
mixed —

getDefaults()

public getDefaults() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getHost()

public getHost() : string
Return values
string —

getMethods()

Returns the uppercased HTTP methods this route is restricted to.

public getMethods() : array<string|int, string>

So an empty array means that any method is allowed.

Return values
array<string|int, string> —

getOption()

Returns the option value or null when not found.

public getOption(string $name) : mixed
Parameters
$name : string
Return values
mixed —

getOptions()

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getPath()

public getPath() : string
Return values
string —

getRequirement()

public getRequirement(string $key) : string|null
Parameters
$key : string
Return values
string|null —

getRequirements()

public getRequirements() : array<string|int, mixed>
Return values
array<string|int, mixed> —

getSchemes()

Returns the lowercased schemes this route is restricted to.

public getSchemes() : array<string|int, string>

So an empty array means that any scheme is allowed.

Return values
array<string|int, string> —

hasDefault()

public hasDefault(string $name) : bool
Parameters
$name : string
Return values
bool —

hasOption()

public hasOption(string $name) : bool
Parameters
$name : string
Return values
bool —

hasRequirement()

public hasRequirement(string $key) : bool
Parameters
$key : string
Return values
bool —

hasScheme()

Checks if a scheme requirement has been set.

public hasScheme(string $scheme) : bool
Parameters
$scheme : string
Return values
bool —

setCondition()

public setCondition(string|null $condition) : $this
Parameters
$condition : string|null
Return values
$this —

setDefault()

Sets a default value.

public setDefault(string $name, mixed $default) : $this
Parameters
$name : string
$default : mixed

The default value

Return values
$this —

setDefaults()

public setDefaults(array<string|int, mixed> $defaults) : $this
Parameters
$defaults : array<string|int, mixed>
Return values
$this —

setHost()

public setHost(string|null $pattern) : $this
Parameters
$pattern : string|null
Return values
$this —

setMethods()

Sets the HTTP methods (e.g. 'POST') this route is restricted to.

public setMethods(string|array<string|int, string> $methods) : $this

So an empty array means that any method is allowed.

Parameters
$methods : string|array<string|int, string>

The method or an array of methods

Return values
$this —

setOption()

Sets an option value.

public setOption(string $name, mixed $value) : $this
Parameters
$name : string
$value : mixed

The option value

Return values
$this —

setOptions()

public setOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>
Return values
$this —

setPath()

public setPath(string $pattern) : $this
Parameters
$pattern : string
Return values
$this —

setRequirement()

public setRequirement(string $key, string $regex) : $this
Parameters
$key : string
$regex : string
Return values
$this —

setRequirements()

public setRequirements(array<string|int, mixed> $requirements) : $this
Parameters
$requirements : array<string|int, mixed>
Return values
$this —

setSchemes()

Sets the schemes (e.g. 'https') this route is restricted to.

public setSchemes(string|array<string|int, string> $schemes) : $this

So an empty array means that any scheme is allowed.

Parameters
$schemes : string|array<string|int, string>

The scheme or an array of schemes

Return values
$this —

extractInlineDefaultsAndRequirements()

private extractInlineDefaultsAndRequirements(string $pattern) : string
Parameters
$pattern : string
Return values
string —

isLocalized()

private isLocalized() : bool
Return values
bool —

sanitizeRequirement()

private sanitizeRequirement(string $key, string $regex) : mixed
Parameters
$key : string
$regex : string
Return values
mixed —

Search results