PHP Class Neos\Flow\Mvc\Routing\Route

Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство 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

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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 méthode

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
Résultat boolean FALSE if one of the $routeValues is not equal to it's default value. Otherwise TRUE

containsObject() protected méthode

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

extractInternalArguments() protected méthode

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

getAppendExceedingArguments() public méthode

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

getDefaults() public méthode

Returns default values for this Route.
public getDefaults ( ) : array
Résultat array Route defaults

getHttpMethods() public méthode

public getHttpMethods ( ) : array
Résultat array

getMatchResults() public méthode

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

getName() public méthode

Returns the name of this Route.
public getName ( ) : string
Résultat string Route name.

getResolvedUriPath() public méthode

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

getRoutePartsConfiguration() public méthode

Returns the route parts configuration of this route
public getRoutePartsConfiguration ( ) : array
Résultat array $routePartsConfiguration

getUriPattern() public méthode

Returns the URI pattern this route should match with
public getUriPattern ( ) : string
Résultat string the URI pattern

hasHttpMethodConstraints() public méthode

Whether or not this route is limited to one or more HTTP verbs
public hasHttpMethodConstraints ( ) : boolean
Résultat boolean

isLowerCase() public méthode

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

matches() public méthode

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
Résultat boolean TRUE if this Route corresponds to the given $routePath, otherwise FALSE

parse() public méthode

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

resolves() public méthode

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
Résultat boolean TRUE if this Route corresponds to the given $routeValues, otherwise FALSE

setAppendExceedingArguments() public méthode

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
Résultat void

setDefaults() public méthode

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

setHttpMethods() public méthode

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

setLowerCase() public méthode

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.
Résultat void

setName() public méthode

Sets Route name.
public setName ( string $name ) : void
$name string The Route name
Résultat void

setRoutePartsConfiguration() public méthode

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
Résultat void

setUriPattern() public méthode

Sets the URI pattern this route should match with
public setUriPattern ( string $uriPattern ) : void
$uriPattern string
Résultat 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
Résultat boolean

$defaults protected_oe property

Default values
protected array $defaults
Résultat 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
Résultat boolean

$lowerCase protected_oe property

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

$matchResults protected_oe property

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

$name protected_oe property

Route name
protected string $name
Résultat string

$objectManager protected_oe property

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
Résultat Neos\Flow\ObjectManagement\ObjectManagerInterface

$persistenceManager protected_oe property

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
Résultat 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
Résultat string

$routeParts protected_oe property

Container for Route Parts.
protected array $routeParts
Résultat 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
Résultat array

$uriPattern protected_oe property

URI Pattern of this route
protected string $uriPattern
Résultat string