[Routing] added getContext() accessor

This commit is contained in:
Fabien Potencier 2011-04-21 21:20:27 +02:00
parent c5497c7c67
commit 813627bd4c
3 changed files with 32 additions and 0 deletions

View File

@ -50,6 +50,16 @@ class UrlGenerator implements UrlGeneratorInterface
$this->context = $context;
}
/**
* Gets the request context.
*
* @return RequestContext The context
*/
public function getContext()
{
return $this->context;
}
/**
* Generates a URL from the given parameters.
*

View File

@ -50,6 +50,16 @@ class UrlMatcher implements UrlMatcherInterface
$this->context = $context;
}
/**
* Gets the request context.
*
* @return RequestContext The context
*/
public function getContext()
{
return $this->context;
}
/**
* Tries to match a URL with a set of routes.
*

View File

@ -106,10 +106,22 @@ class Router implements RouterInterface
*/
public function setContext(RequestContext $context)
{
$this->context = $context;
$this->getMatcher()->setContext($context);
$this->getGenerator()->setContext($context);
}
/**
* Gets the request context.
*
* @return RequestContext The context
*/
public function getContext()
{
return $this->context;
}
/**
* Generates a URL from the given parameters.
*