PHP Класс 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}
Показать файл Открыть проект

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
_getMatches ( string $path ) : array Finds route pattern matches for the given path.

Приватные методы

Метод Описание
_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

Описание методов

__construct() публичный Метод

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

_getMatches() защищенный Метод

Returns empty array if no matches found (indicating route doesn't match $path).
protected _getMatches ( string $path ) : array
$path string
Результат array

getMatch() публичный Метод

public getMatch ( $path, $metadata = null ) : RouteMatch
Результат RouteMatch or null if no match.

getName() публичный Метод

Returns the route name of the entry
public getName ( )

getParameterNames() публичный Метод

Returns the names of the replaceable parameters defined in this route
public getParameterNames ( ) : array
Результат array

interpolate() публичный Метод

public interpolate ( array $parameters ) : string
$parameters array
Результат string