public function register(Container $app) { $app['var_dumper.cloner'] = function ($app) { $cloner = new VarCloner(); if (isset($app['debug.max_items'])) { $cloner->setMaxItems($app['debug.max_items']); } if (isset($app['debug.max_string_length'])) { $cloner->setMaxString($app['debug.max_string_length']); } return $cloner; }; $app['data_collector.templates'] = $app->extend('data_collector.templates', function ($templates) { $templates[] = array('dump', '@Debug/Profiler/dump.html.twig'); return $templates; }); $app['data_collector.dump'] = function ($app) { return new DumpDataCollector($app['stopwatch'], $app['code.file_link_format']); }; $app->extend('data_collectors', function ($collectors, $app) { $collectors['dump'] = function ($app) { return $app['data_collector.dump']; }; return $collectors; }); $app->extend('twig', function ($twig, $app) { if (class_exists('\\Symfony\\Bridge\\Twig\\Extension\\DumpExtension')) { $twig->addExtension(new DumpExtension($app['var_dumper.cloner'])); } return $twig; }); $app->extend('twig.loader.filesystem', function ($loader, $app) { $loader->addPath($app['debug.templates_path'], 'Debug'); return $loader; }); $app['debug.templates_path'] = function () { $r = new \ReflectionClass('Symfony\\Bundle\\DebugBundle\\DependencyInjection\\Configuration'); return dirname(dirname($r->getFileName())) . '/Resources/views'; }; }