PHP Class Ergo\Routing\Route

Parses routes with parameters in them e.g
http://example.org/{myparam}
http://example.org/{myparam:integer}
http://example.org/{myparam:string}
http://example.org/{myparam}/{myparam2}?test={myparam3}
Afficher le fichier Open project: 99designs/ergo

Méthodes publiques

Méthode Description
__construct ( string $name, string $template )
getMatch ( $path, $metadata = null ) : RouteMatch
getName ( ) Returns the route name of the entry
getParameterNames ( ) : array Returns the names of the replaceable parameters defined in this route
interpolate ( array $parameters ) : string

Méthodes protégées

Méthode Description
_getMatches ( string $path ) : array Finds route pattern matches for the given path.

Private Methods

Méthode Description
_escapeTemplate ( string $template ) : string Escape for regex except for curly braces, which are pulled out later.
_extractParameterNames ( string $template ) : array
_getParameterPattern ( string $template ) : array Gets a pattern that can be used for parsing a template
_interpolateCallback ( $matches ) A callback for preg_replace_callback() that returns interpolation parameters
_typePatternCallback ( $matches ) A callback for preg_replace_callback() that returns pattern chunks for a type

Method Details

__construct() public méthode

public __construct ( string $name, string $template )
$name string
$template string

_getMatches() protected méthode

Returns empty array if no matches found (indicating route doesn't match $path).
protected _getMatches ( string $path ) : array
$path string
Résultat array

getMatch() public méthode

public getMatch ( $path, $metadata = null ) : RouteMatch
Résultat RouteMatch or null if no match.

getName() public méthode

Returns the route name of the entry
public getName ( )

getParameterNames() public méthode

Returns the names of the replaceable parameters defined in this route
public getParameterNames ( ) : array
Résultat array

interpolate() public méthode

public interpolate ( array $parameters ) : string
$parameters array
Résultat string