‪TYPO3CMS  ‪main
TYPO3\CMS\Backend\Routing\Route Class Reference

Public Member Functions

 __construct ($path, $options)
 
string getPath ()
 
Route setPath ($pattern)
 
string[] getMethods ()
 
 setMethods (array $methods)
 
array getOptions ()
 
Route setOptions (array $options)
 
Route setOption ($name, $value)
 
mixed getOption ($name)
 
bool hasOption ($name)
 

Protected Attributes

string $path = '/'
 
array $methods = []
 
array $options = array( )
 

Detailed Description

This is a single entity for a Route.

The architecture is highly inspired by the Symfony Routing Component.

Definition at line 23 of file Route.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Routing\Route::__construct (   $path,
  $options 
)

Constructor setting up the required path and options

Parameters
string$path‪The path pattern to match
array$options‪An array of options

Definition at line 41 of file Route.php.

References TYPO3\CMS\Backend\Routing\Route\$options, TYPO3\CMS\Backend\Routing\Route\setOptions(), and TYPO3\CMS\Backend\Routing\Route\setPath().

Member Function Documentation

◆ getMethods()

string [] TYPO3\CMS\Backend\Routing\Route::getMethods ( )

Returns the uppercased HTTP methods this route is restricted to. An empty array means that any method is allowed.

Returns
‪string[] The methods

Definition at line 78 of file Route.php.

References TYPO3\CMS\Backend\Routing\Route\$methods.

Referenced by TYPO3\CMS\Backend\Routing\Router\addRoute().

◆ getOption()

mixed TYPO3\CMS\Backend\Routing\Route::getOption (   $name)

Get an option value

Parameters
string$name‪An option name
Returns
‪mixed The option value or NULL when not given

Definition at line 142 of file Route.php.

Referenced by TYPO3\CMS\Backend\Http\RouteDispatcher\assertRequestToken(), TYPO3\CMS\Backend\Routing\RouteRedirect\createFromRoute(), and TYPO3\CMS\Backend\Http\RouteDispatcher\enforceReferrer().

◆ getOptions()

array TYPO3\CMS\Backend\Routing\Route::getOptions ( )

Returns the options set

Returns
‪array The options

Definition at line 102 of file Route.php.

References TYPO3\CMS\Backend\Routing\Route\$options.

Referenced by TYPO3\CMS\Backend\Routing\Router\addRoute().

◆ getPath()

◆ hasOption()

bool TYPO3\CMS\Backend\Routing\Route::hasOption (   $name)

Checks if an option has been set

Parameters
string$name‪An option name
Returns
‪bool TRUE if the option is set, FALSE otherwise

Definition at line 153 of file Route.php.

◆ setMethods()

TYPO3\CMS\Backend\Routing\Route::setMethods ( array  $methods)

Sets the HTTP methods (e.g. ['POST']) this route is restricted to. An empty array means that any method is allowed.

This method implements a fluent interface.

Parameters
string[]$methods‪The array of allowed methods

Definition at line 91 of file Route.php.

References TYPO3\CMS\Backend\Routing\Route\$methods.

◆ setOption()

Route TYPO3\CMS\Backend\Routing\Route::setOption (   $name,
  $value 
)

Sets an option value

This method implements a fluent interface.

Parameters
string$name‪An option name
mixed$value‪The option value
Returns
Route The current Route instance

Definition at line 130 of file Route.php.

◆ setOptions()

Route TYPO3\CMS\Backend\Routing\Route::setOptions ( array  $options)

Sets the options

This method implements a fluent interface.

Parameters
array$options‪The options
Returns
Route The current Route instance

Definition at line 115 of file Route.php.

References TYPO3\CMS\Backend\Routing\Route\$options.

Referenced by TYPO3\CMS\Backend\Routing\Route\__construct().

◆ setPath()

Route TYPO3\CMS\Backend\Routing\Route::setPath (   $pattern)

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'.

This method implements a fluent interface.

Parameters
string$pattern‪The path pattern
Returns
Route The current Route instance

Definition at line 66 of file Route.php.

Referenced by TYPO3\CMS\Backend\Routing\Route\__construct().

Member Data Documentation

◆ $methods

array TYPO3\CMS\Backend\Routing\Route::$methods = []
protected

◆ $options

array TYPO3\CMS\Backend\Routing\Route::$options = array( )
protected

◆ $path

string TYPO3\CMS\Backend\Routing\Route::$path = '/'
protected

Definition at line 27 of file Route.php.

Referenced by TYPO3\CMS\Backend\Routing\Route\getPath().