public function __construct($options = [], Application $app = null, RepositoryContract $config = null, Dispatcher $dispatcher = null) { static::$options = $config !== null ? array_merge($options, $config->get('tracy')) : $options; TracyDebugger::$time = array_get($_SERVER, 'REQUEST_TIME_FLOAT', microtime(true)); TracyDebugger::$maxDepth = array_get(static::$options, 'maxDepth'); TracyDebugger::$maxLen = array_get(static::$options, 'maxLen'); TracyDebugger::$showLocation = array_get(static::$options, 'showLocation'); TracyDebugger::$strictMode = array_get(static::$options, 'strictMode'); TracyDebugger::$editor = array_get(static::$options, 'editor'); $bar = TracyDebugger::getBar(); foreach (array_get(static::$options, 'panels') as $key => $enabled) { if ($enabled === true) { $class = '\\' . __NAMESPACE__ . '\\Panels\\' . ucfirst($key) . 'Panel'; if (class_exists($class) === false) { $class = $key; } $this->panels[$key] = new $class($app, static::$options); $bar->addPanel($this->panels[$key], $class); } } if ($dispatcher !== null) { $dispatcher->listen('kernel.handled', function ($request, $response) { return static::appendDebugbar($request, $response); }); } else { TracyDebugger::enable(); } }
/** * initializeTracyDebuger. * * @method initializeTracyDebuger * * @param array $config */ protected function initializeTracyDebuger($config) { Debugger::$editor = Arr::get($config, 'editor', Debugger::$editor); Debugger::$maxDepth = Arr::get($config, 'maxDepth', Debugger::$maxDepth); Debugger::$maxLength = Arr::get($config, 'maxLength', Debugger::$maxLength); Debugger::$scream = Arr::get($config, 'scream', true); Debugger::$showLocation = Arr::get($config, 'showLocation', true); Debugger::$strictMode = Arr::get($config, 'strictMode', true); Debugger::$time = Arr::get($_SERVER, 'REQUEST_TIME_FLOAT', microtime(true)); Debugger::$editorMapping = Arr::get($config, 'editorMapping', []); }
protected function registerDebugger() { $config = $this->app['config']['tracy']; Debugger::$time = array_get($_SERVER, 'REQUEST_TIME_FLOAT', microtime(true)); Debugger::$maxDepth = array_get($config, 'maxDepth'); Debugger::$maxLen = array_get($config, 'maxLen'); Debugger::$showLocation = array_get($config, 'showLocation'); Debugger::$strictMode = array_get($config, 'strictMode'); Debugger::$editor = array_get($config, 'editor'); $bar = Debugger::getBar(); foreach ($config['panels'] as $key => $enabled) { if ($enabled === true or $enabled === '1') { $class = '\\' . __NAMESPACE__ . '\\Panels\\' . ucfirst($key) . 'Panel'; $bar->addPanel(new $class($config, $this->app), $class); } elseif (is_string($enabled) === true) { $class = $enabled; $bar->addPanel(new $class($config, $this->app), $class); } } }