PHP Class Neos\Flow\Mvc\Routing\Route

Exibir arquivo Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$appendExceedingArguments boolean Specifies whether Route Values, that are not part of the Routes configuration, should be appended as query string
$defaults array Default values
$httpMethods If not empty only the specified HTTP verbs are accepted by this route
$isParsed boolean For better performance, routes are only parsed if needed.
$lowerCase boolean Specifies whether Route Parts of this Route should be converted to lower case when resolved.
$matchResults array Contains the routing results (indexed by "package", "controller" and "action") after a successful call of matches()
$name string Route name
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$persistenceManager Neos\Flow\Persistence\PersistenceManagerInterface
$resolvedUriPath string Contains the matching uri (excluding protocol and host) after a successful call of resolves()
$routeParts array Container for Route Parts.
$routePartsConfiguration array Contains associative array of Route Part options (key: Route Part name, value: array of Route Part options)
$uriPattern string URI Pattern of this route

Public Methods

Method Description
getAppendExceedingArguments ( ) : boolean Returns TRUE if exceeding arguments should be appended to the URI as query string, otherwise FALSE
getDefaults ( ) : array Returns default values for this Route.
getHttpMethods ( ) : array
getMatchResults ( ) : array Returns an array with the Route match results.
getName ( ) : string Returns the name of this Route.
getResolvedUriPath ( ) : string Returns the URI path which corresponds to this Route.
getRoutePartsConfiguration ( ) : array Returns the route parts configuration of this route
getUriPattern ( ) : string Returns the URI pattern this route should match with
hasHttpMethodConstraints ( ) : boolean Whether or not this route is limited to one or more HTTP verbs
isLowerCase ( ) : boolean Getter for $this->lowerCase.
matches ( Request $httpRequest ) : boolean Checks whether $routePath corresponds to this Route.
parse ( ) : void Iterates through all segments in $this->uriPattern and creates appropriate RoutePart instances.
resolves ( array $routeValues ) : boolean Checks whether $routeValues can be resolved to a corresponding uri.
setAppendExceedingArguments ( boolean $appendExceedingArguments ) : void Specifies whether Route values, that are not part of the Route configuration, should be appended to the Resulting URI as query string.
setDefaults ( array $defaults ) : void Sets default values for this Route.
setHttpMethods ( array $httpMethods ) : void Limits the HTTP verbs that are accepted by this route.
setLowerCase ( boolean $lowerCase ) : void Specifies whether Route parts of this route should be converted to lower case when resolved.
setName ( string $name ) : void Sets Route name.
setRoutePartsConfiguration ( array $routePartsConfiguration ) : void By default all Dynamic Route Parts are resolved by \Neos\Flow\Mvc\Routing\DynamicRoutePart.
setUriPattern ( string $uriPattern ) : void Sets the URI pattern this route should match with

Protected Methods

Method Description
compareAndRemoveMatchingDefaultValues ( array $defaults, array &$routeValues ) : boolean Recursively iterates through the defaults of this route.
containsObject ( mixed $subject ) : boolean Checks if the given subject contains an object
extractInternalArguments ( array &$arguments ) : array Removes all internal arguments (prefixed with two underscores) from the given $arguments and returns them as array

Method Details

compareAndRemoveMatchingDefaultValues() protected method

If a route value is equal to a default value, it's removed from $routeValues. If a value exists but is not equal to is corresponding default, iteration is interrupted and FALSE is returned.
protected compareAndRemoveMatchingDefaultValues ( array $defaults, array &$routeValues ) : boolean
$defaults array
$routeValues array
return boolean FALSE if one of the $routeValues is not equal to it's default value. Otherwise TRUE

containsObject() protected method

Checks if the given subject contains an object
protected containsObject ( mixed $subject ) : boolean
$subject mixed
return boolean If it contains an object or not

extractInternalArguments() protected method

Removes all internal arguments (prefixed with two underscores) from the given $arguments and returns them as array
protected extractInternalArguments ( array &$arguments ) : array
$arguments array
return array the internal arguments

getAppendExceedingArguments() public method

Returns TRUE if exceeding arguments should be appended to the URI as query string, otherwise FALSE

getDefaults() public method

Returns default values for this Route.
public getDefaults ( ) : array
return array Route defaults

getHttpMethods() public method

public getHttpMethods ( ) : array
return array

getMatchResults() public method

Returns an array with the Route match results.
See also: Neos\Flow\Mvc\Routing\Router
public getMatchResults ( ) : array
return array An array of Route Parts and their values for further handling by the Router

getName() public method

Returns the name of this Route.
public getName ( ) : string
return string Route name.

getResolvedUriPath() public method

Returns the URI path which corresponds to this Route.
public getResolvedUriPath ( ) : string
return string A string containing the corresponding uri (excluding protocol and host)

getRoutePartsConfiguration() public method

Returns the route parts configuration of this route
public getRoutePartsConfiguration ( ) : array
return array $routePartsConfiguration

getUriPattern() public method

Returns the URI pattern this route should match with
public getUriPattern ( ) : string
return string the URI pattern

hasHttpMethodConstraints() public method

Whether or not this route is limited to one or more HTTP verbs

isLowerCase() public method

Getter for $this->lowerCase.
See also: setLowerCase()
public isLowerCase ( ) : boolean
return boolean TRUE if this Route part will be converted to lower case, otherwise FALSE.

matches() public method

If all Route Parts match successfully TRUE is returned and $this->matchResults contains an array combining Route default values and calculated matchResults from the individual Route Parts.
See also: getMatchResults()
public matches ( Request $httpRequest ) : boolean
$httpRequest Neos\Flow\Http\Request the HTTP request to match
return boolean TRUE if this Route corresponds to the given $routePath, otherwise FALSE

parse() public method

Iterates through all segments in $this->uriPattern and creates appropriate RoutePart instances.
public parse ( ) : void
return void

resolves() public method

If all Route Parts can resolve one or more of the $routeValues, TRUE is returned and $this->matchingURI contains the generated URI (excluding protocol and host).
public resolves ( array $routeValues ) : boolean
$routeValues array An array containing key/value pairs to be resolved to uri segments
return boolean TRUE if this Route corresponds to the given $routeValues, otherwise FALSE

setAppendExceedingArguments() public method

If set to FALSE, the route won't resolve if there are route values left after iterating through all Route Part handlers and removing the matching default values.
public setAppendExceedingArguments ( boolean $appendExceedingArguments ) : void
$appendExceedingArguments boolean TRUE: exceeding arguments will be appended to the resulting URI
return void

setDefaults() public method

This array is merged with the actual matchResults when match() is called.
public setDefaults ( array $defaults ) : void
$defaults array
return void

setHttpMethods() public method

If empty all HTTP verbs are accepted
public setHttpMethods ( array $httpMethods ) : void
$httpMethods array non-associative array in the format array('GET', 'POST', ...)
return void

setLowerCase() public method

This setting can be overwritten for all dynamic Route parts.
public setLowerCase ( boolean $lowerCase ) : void
$lowerCase boolean TRUE: Route parts are converted to lower case by default. FALSE: Route parts are not altered.
return void

setName() public method

Sets Route name.
public setName ( string $name ) : void
$name string The Route name
return void

setRoutePartsConfiguration() public method

But you can specify different classes to handle particular Route Parts. Note: Route Part handlers must implement \Neos\Flow\Mvc\Routing\DynamicRoutePartInterface. Usage: setRoutePartsConfiguration(array('@controller' => array('handler' => \Neos\Package\Subpackage\MyRoutePartHandler::class)));
public setRoutePartsConfiguration ( array $routePartsConfiguration ) : void
$routePartsConfiguration array Route Parts configuration options
return void

setUriPattern() public method

Sets the URI pattern this route should match with
public setUriPattern ( string $uriPattern ) : void
$uriPattern string
return void

Property Details

$appendExceedingArguments protected_oe property

Specifies whether Route Values, that are not part of the Routes configuration, should be appended as query string
protected bool $appendExceedingArguments
return boolean

$defaults protected_oe property

Default values
protected array $defaults
return array

$httpMethods protected_oe property

If not empty only the specified HTTP verbs are accepted by this route
protected $httpMethods

$isParsed protected_oe property

For better performance, routes are only parsed if needed.
protected bool $isParsed
return boolean

$lowerCase protected_oe property

Specifies whether Route Parts of this Route should be converted to lower case when resolved.
protected bool $lowerCase
return boolean

$matchResults protected_oe property

Contains the routing results (indexed by "package", "controller" and "action") after a successful call of matches()
protected array $matchResults
return array

$name protected_oe property

Route name
protected string $name
return string

$objectManager protected_oe property

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
return Neos\Flow\ObjectManagement\ObjectManagerInterface

$persistenceManager protected_oe property

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
return Neos\Flow\Persistence\PersistenceManagerInterface

$resolvedUriPath protected_oe property

Contains the matching uri (excluding protocol and host) after a successful call of resolves()
protected string $resolvedUriPath
return string

$routeParts protected_oe property

Container for Route Parts.
protected array $routeParts
return array

$routePartsConfiguration protected_oe property

Contains associative array of Route Part options (key: Route Part name, value: array of Route Part options)
protected array $routePartsConfiguration
return array

$uriPattern protected_oe property

URI Pattern of this route
protected string $uriPattern
return string