You are here

class DumpListener in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/EventListener/DumpListener.php \Symfony\Component\HttpKernel\EventListener\DumpListener

Configures dump() handler.

@author Nicolas Grekas <p@tchwork.com>

Hierarchy

Expanded class hierarchy of DumpListener

1 file declares its use of DumpListener
DumpListenerTest.php in vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php

File

vendor/symfony/http-kernel/EventListener/DumpListener.php, line 25

Namespace

Symfony\Component\HttpKernel\EventListener
View source
class DumpListener implements EventSubscriberInterface {
  private $cloner;
  private $dumper;

  /**
   * @param ClonerInterface     $cloner Cloner service.
   * @param DataDumperInterface $dumper Dumper service.
   */
  public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper) {
    $this->cloner = $cloner;
    $this->dumper = $dumper;
  }
  public function configure() {
    $cloner = $this->cloner;
    $dumper = $this->dumper;
    VarDumper::setHandler(function ($var) use ($cloner, $dumper) {
      $dumper
        ->dump($cloner
        ->cloneVar($var));
    });
  }
  public static function getSubscribedEvents() {

    // Register early to have a working dump() as early as possible
    return array(
      KernelEvents::REQUEST => array(
        'configure',
        1024,
      ),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DumpListener::$cloner private property
DumpListener::$dumper private property
DumpListener::configure public function
DumpListener::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface::getSubscribedEvents
DumpListener::__construct public function