class RouterDataCollector in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php \Symfony\Component\HttpKernel\DataCollector\RouterDataCollector
RouterDataCollector.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\HttpKernel\DataCollector\DataCollector implements \Symfony\Component\HttpKernel\DataCollector\Serializable, DataCollectorInterface
- class \Symfony\Component\HttpKernel\DataCollector\RouterDataCollector
Expanded class hierarchy of RouterDataCollector
File
- vendor/
symfony/ http-kernel/ DataCollector/ RouterDataCollector.php, line 24
Namespace
Symfony\Component\HttpKernel\DataCollectorView source
class RouterDataCollector extends DataCollector {
protected $controllers;
public function __construct() {
$this->controllers = new \SplObjectStorage();
$this->data = array(
'redirect' => false,
'url' => null,
'route' => null,
);
}
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null) {
if ($response instanceof RedirectResponse) {
$this->data['redirect'] = true;
$this->data['url'] = $response
->getTargetUrl();
if ($this->controllers
->contains($request)) {
$this->data['route'] = $this
->guessRoute($request, $this->controllers[$request]);
}
}
unset($this->controllers[$request]);
}
protected function guessRoute(Request $request, $controller) {
return 'n/a';
}
/**
* Remembers the controller associated to each request.
*
* @param FilterControllerEvent $event The filter controller event
*/
public function onKernelController(FilterControllerEvent $event) {
$this->controllers[$event
->getRequest()] = $event
->getController();
}
/**
* @return bool Whether this request will result in a redirect
*/
public function getRedirect() {
return $this->data['redirect'];
}
/**
* @return string|null The target URL
*/
public function getTargetUrl() {
return $this->data['url'];
}
/**
* @return string|null The target route
*/
public function getTargetRoute() {
return $this->data['route'];
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'router';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DataCollector:: |
protected | property | ||
DataCollector:: |
private | property | ||
DataCollector:: |
public | function | 1 | |
DataCollector:: |
public | function | 1 | |
DataCollector:: |
protected | function | Converts a PHP variable to a string. | |
RouterDataCollector:: |
protected | property | ||
RouterDataCollector:: |
public | function |
Collects data for the given Request and Response. Overrides DataCollectorInterface:: |
|
RouterDataCollector:: |
public | function |
Returns the name of the collector. Overrides DataCollectorInterface:: |
|
RouterDataCollector:: |
public | function | ||
RouterDataCollector:: |
public | function | ||
RouterDataCollector:: |
public | function | ||
RouterDataCollector:: |
protected | function | ||
RouterDataCollector:: |
public | function | Remembers the controller associated to each request. | |
RouterDataCollector:: |
public | function |