Route

class \TYPO3\CMS\Backend\Routing\Route

This is a single entity for a Route.

The architecture is highly inspired by the Symfony Routing Component.

Table of Contents

Properties

$methods  : array
$options  : array
$path  : string

Methods

__construct()  : mixed
Constructor setting up the required path and options
getMethods()  : string[]
Returns the uppercased HTTP methods this route is restricted to.
getOption()  : mixed
Get an option value
getOptions()  : array
Returns the options set
getPath()  : string
Returns the path
hasOption()  : bool
Checks if an option has been set
setMethods()  : self
Sets the HTTP methods (e.g. ['POST']) this route is restricted to.
setOption()  : Route
Sets an option value
setOptions()  : Route
Sets the options
setPath()  : Route
Sets the pattern for the path A pattern must start with a slash and must not have multiple slashes at the beginning because the generated path for this route would be confused with a network path, e.g. '//domain.com/path'.

Properties

Methods

__construct()

Constructor setting up the required path and options

public __construct(string $path, array $options) : mixed

Parameters

$path : string

The path pattern to match

$options : array

An array of options

getMethods()

Returns the uppercased HTTP methods this route is restricted to.

public getMethods() : string[]

An empty array means that any method is allowed.

Return values

string[] —

The methods

getOption()

Get an option value

public getOption(string $name) : mixed

Parameters

$name : string

An option name

Return values

mixed —

The option value or NULL when not given

getOptions()

Returns the options set

public getOptions() : array

Return values

array —

The options

getPath()

Returns the path

public getPath() : string

Return values

string —

The path pattern

hasOption()

Checks if an option has been set

public hasOption(string $name) : bool

Parameters

$name : string

An option name

Return values

bool —

TRUE if the option is set, FALSE otherwise

setMethods()

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

public setMethods(string[] $methods) : self

An empty array means that any method is allowed.

This method implements a fluent interface.

Parameters

$methods : string[]

The array of allowed methods

Return values

self

setOption()

Sets an option value

public setOption(string $name, mixed $value) : Route

This method implements a fluent interface.

Parameters

$name : string

An option name

$value : mixed

The option value

Return values

Route —

The current Route instance

setOptions()

Sets the options

public setOptions(array $options) : Route

This method implements a fluent interface.

Parameters

$options : array

The options

Return values

Route —

The current Route instance

setPath()

Sets the pattern for the path A pattern must start with a slash and must not have multiple slashes at the beginning because the generated path for this route would be confused with a network path, e.g. '//domain.com/path'.

public setPath(string $pattern) : Route

This method implements a fluent interface.

Parameters

$pattern : string

The path pattern

Return values

Route —

The current Route instance

On this page