Вход Регистрация
Файл: gapps/vendor/symfony/http-kernel/EventListener/DumpListener.php
Строк: 82
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SymfonyComponentHttpKernelEventListener;

use 
SymfonyComponentEventDispatcherEventSubscriberInterface;
use 
SymfonyComponentHttpKernelKernelEvents;
use 
SymfonyComponentVarDumperClonerClonerInterface;
use 
SymfonyComponentVarDumperDumperDataDumperInterface;
use 
SymfonyComponentVarDumperVarDumper;

/**
 * Configures dump() handler.
 *
 * @author Nicolas Grekas <p@tchwork.com>
 */
class DumpListener implements EventSubscriberInterface
{
    private 
$cloner;
    private 
$dumper;

    
/**
     * @param ClonerInterface     $cloner Cloner service
     * @param DataDumperInterface $dumper Dumper service
     */
    
public function __construct(ClonerInterface $clonerDataDumperInterface $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));
    }
}
Онлайн: 1
Реклама