for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of Dedipanel project
*
* (c) 2010-2015 Dedipanel <http://www.dedicated-panel.net>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace DP\Core\CoreBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
* Modify services requiring logger with phpseclib channel
* and inject NullLogger if debug is disabled
* @package DP\Core\CoreBundle\DependencyInjection\Compiler
class PhpseclibDebugCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
if (!$container->getParameterBag()->get('dedipanel.debug')) {
$this->replaceByNullLogger($container, 'monolog.handler.phpseclib_wrapper');
$this->replaceByNullLogger($container, 'monolog.handler.phpseclib_internal');
}
* @param string $handler
private function replaceByNullLogger(ContainerBuilder $container, $handler)
$def = $container->getDefinition($handler);
$def->setClass('%monolog.handler.null.class%');
$container->setDefinition($handler, $def);