PHP Class Symfony\Component\Routing\Router

Author: Fabien Potencier ([email protected])
Inheritance: implements Symfony\Component\Routing\RouterInterface, implements Symfony\Component\Routing\Matcher\RequestMatcherInterface
Afficher le fichier Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Свойство Type Description
$collection
$context
$defaults
$generator
$loader
$matcher
$options
$resource

Méthodes publiques

Méthode Description
__construct ( Symfony\Component\Config\Loader\LoaderInterface $loader, mixed $resource, array $options = [], Symfony\Component\Routing\RequestContext $context = null, array $defaults = [] ) Constructor.
generate ( string $name, array $parameters = [], boolean $absolute = false ) : string Generates a URL from the given parameters.
getContext ( ) : Symfony\Component\Routing\RequestContext Gets the request context.
getGenerator ( ) : UrlGeneratorInterface Gets the UrlGenerator instance associated with this Router.
getMatcher ( ) : UrlMatcherInterface Gets the UrlMatcher instance associated with this Router.
getOption ( string $key ) : mixed Gets an option value.
getRouteCollection ( ) : RouteCollection Gets the RouteCollection instance associated with this Router.
match ( string $url ) : array | false Tries to match a URL with a set of routes.
setContext ( Symfony\Component\Routing\RequestContext $context ) Sets the request context.
setOption ( string $key, mixed $value ) Sets an option.
setOptions ( array $options ) Sets options.

Method Details

__construct() public méthode

Constructor.
public __construct ( Symfony\Component\Config\Loader\LoaderInterface $loader, mixed $resource, array $options = [], Symfony\Component\Routing\RequestContext $context = null, array $defaults = [] )
$loader Symfony\Component\Config\Loader\LoaderInterface A LoaderInterface instance
$resource mixed The main resource to load
$options array An array of options
$context Symfony\Component\Routing\RequestContext The context
$defaults array The default values

generate() public méthode

Generates a URL from the given parameters.
public generate ( string $name, array $parameters = [], boolean $absolute = false ) : string
$name string The name of the route
$parameters array An array of parameters
$absolute boolean Whether to generate an absolute URL
Résultat string The generated URL

getContext() public méthode

Gets the request context.
public getContext ( ) : Symfony\Component\Routing\RequestContext
Résultat Symfony\Component\Routing\RequestContext The context

getGenerator() public méthode

Gets the UrlGenerator instance associated with this Router.
public getGenerator ( ) : UrlGeneratorInterface
Résultat UrlGeneratorInterface A UrlGeneratorInterface instance

getMatcher() public méthode

Gets the UrlMatcher instance associated with this Router.
public getMatcher ( ) : UrlMatcherInterface
Résultat UrlMatcherInterface A UrlMatcherInterface instance

getOption() public méthode

Gets an option value.
public getOption ( string $key ) : mixed
$key string The key
Résultat mixed The value

getRouteCollection() public méthode

Gets the RouteCollection instance associated with this Router.
public getRouteCollection ( ) : RouteCollection
Résultat RouteCollection A RouteCollection instance

match() public méthode

Returns false if no route matches the URL.
public match ( string $url ) : array | false
$url string URL to be parsed
Résultat array | false An array of parameters or false if no route matches

setContext() public méthode

Sets the request context.
public setContext ( Symfony\Component\Routing\RequestContext $context )
$context Symfony\Component\Routing\RequestContext The context

setOption() public méthode

Sets an option.
public setOption ( string $key, mixed $value )
$key string The key
$value mixed The value

setOptions() public méthode

Available options: * cache_dir: The cache directory (or null to disable caching) * debug: Whether to enable debugging or not (false by default) * resource_type: Type hint for the main resource (optional)
public setOptions ( array $options )
$options array An array of options

Property Details

$collection protected_oe property

protected $collection

$context protected_oe property

protected $context

$defaults protected_oe property

protected $defaults

$generator protected_oe property

protected $generator

$loader protected_oe property

protected $loader

$matcher protected_oe property

protected $matcher

$options protected_oe property

protected $options

$resource protected_oe property

protected $resource