class FilterControllerEvent in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Event/FilterControllerEvent.php \Symfony\Component\HttpKernel\Event\FilterControllerEvent
Allows filtering of a controller callable.
You can call getController() to retrieve the current controller. With setController() you can set a new controller that is used in the processing of the request.
Controllers should be callables.
@author Bernhard Schussek <bschussek@gmail.com>
Hierarchy
- class \Symfony\Component\EventDispatcher\Event- class \Symfony\Component\HttpKernel\Event\KernelEvent- class \Symfony\Component\HttpKernel\Event\FilterControllerEvent
 
 
- class \Symfony\Component\HttpKernel\Event\KernelEvent
Expanded class hierarchy of FilterControllerEvent
6 files declare their use of FilterControllerEvent
- EarlyRenderingControllerWrapperSubscriber.php in core/lib/ Drupal/ Core/ EventSubscriber/ EarlyRenderingControllerWrapperSubscriber.php 
- Contains \Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.
- HttpKernel.php in vendor/symfony/ http-kernel/ HttpKernel.php 
- PathSubscriber.php in core/lib/ Drupal/ Core/ EventSubscriber/ PathSubscriber.php 
- Contains \Drupal\Core\EventSubscriber\PathSubscriber.
- RequestDataCollector.php in vendor/symfony/ http-kernel/ DataCollector/ RequestDataCollector.php 
- RequestDataCollectorTest.php in vendor/symfony/ http-kernel/ Tests/ DataCollector/ RequestDataCollectorTest.php 
File
- vendor/symfony/ http-kernel/ Event/ FilterControllerEvent.php, line 28 
Namespace
Symfony\Component\HttpKernel\EventView source
class FilterControllerEvent extends KernelEvent {
  /**
   * The current controller.
   */
  private $controller;
  public function __construct(HttpKernelInterface $kernel, $controller, Request $request, $requestType) {
    parent::__construct($kernel, $request, $requestType);
    $this
      ->setController($controller);
  }
  /**
   * Returns the current controller.
   *
   * @return callable
   */
  public function getController() {
    return $this->controller;
  }
  /**
   * Sets a new controller.
   *
   * @param callable $controller
   *
   * @throws \LogicException
   */
  public function setController($controller) {
    // controller must be a callable
    if (!is_callable($controller)) {
      throw new \LogicException(sprintf('The controller must be a callable (%s given).', $this
        ->varToString($controller)));
    }
    $this->controller = $controller;
  }
  private function varToString($var) {
    if (is_object($var)) {
      return sprintf('Object(%s)', get_class($var));
    }
    if (is_array($var)) {
      $a = array();
      foreach ($var as $k => $v) {
        $a[] = sprintf('%s => %s', $k, $this
          ->varToString($v));
      }
      return sprintf('Array(%s)', implode(', ', $a));
    }
    if (is_resource($var)) {
      return sprintf('Resource(%s)', get_resource_type($var));
    }
    if (null === $var) {
      return 'null';
    }
    if (false === $var) {
      return 'false';
    }
    if (true === $var) {
      return 'true';
    }
    return (string) $var;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| Event:: | private | property | ||
| Event:: | private | property | ||
| Event:: | private | property | ||
| Event:: | public | function | Returns the EventDispatcher that dispatches this Event. | |
| Event:: | public | function | Gets the event's name. | |
| Event:: | public | function | Returns whether further event listeners should be triggered. | |
| Event:: | public | function | Stores the EventDispatcher that dispatches this Event. | |
| Event:: | public | function | Sets the event's name property. | |
| Event:: | public | function | Stops the propagation of the event to further event listeners. | |
| FilterControllerEvent:: | private | property | The current controller. | |
| FilterControllerEvent:: | public | function | Returns the current controller. | |
| FilterControllerEvent:: | public | function | Sets a new controller. | |
| FilterControllerEvent:: | private | function | ||
| FilterControllerEvent:: | public | function | Overrides KernelEvent:: | |
| KernelEvent:: | private | property | The kernel in which this event was thrown. | |
| KernelEvent:: | private | property | The request the kernel is currently processing. | |
| KernelEvent:: | private | property | The request type the kernel is currently processing. One of HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST. | |
| KernelEvent:: | public | function | Returns the kernel in which this event was thrown. | |
| KernelEvent:: | public | function | Returns the request the kernel is currently processing. | |
| KernelEvent:: | public | function | Returns the request type the kernel is currently processing. | |
| KernelEvent:: | public | function | Checks if this is a master request. | 
