Exemplo n.º 1
0
 public function init($initialiser = null)
 {
     $toolbarConfig = $this->config("bundl\\debugtoolbar");
     $baseUrl = $toolbarConfig->getStr("base_url", '/_debugbar');
     if (starts_with($baseUrl, '/')) {
         $passthroughs = $this->config("dispatch")->getArr("passthrough");
         if (!isset($passthroughs[substr($baseUrl, 1)])) {
             throw new \Exception("Please add the following to your defaults.ini within [dispatch]\n" . "passthrough[" . substr($baseUrl, 1) . "] = " . "../vendor/maximebf/debugbar/src/DebugBar/Resources");
         }
     }
     EventManager::listen(EventManager::CUBEX_WEBPAGE_RENDER_BODY, [$this, "renderBody"]);
     EventManager::listen(EventManager::CUBEX_WEBPAGE_RENDER_HEAD, [$this, "renderHead"]);
     EventManager::listen(EventManager::CUBEX_LOG, [$this, "catchLog"]);
     $this->_debugBar = new DebugBar();
     $this->_debugBar->addCollector(new PhpInfoCollector());
     $this->_debugBar->addCollector(new MessagesCollector());
     $this->_debugBar->addCollector(new TranslationDataCollector());
     $this->_debugBar->addCollector(new RequestDataCollector());
     $this->_debugBar->addCollector(new CubexCoreTimeData());
     $this->_debugBar->addCollector(new CassandraDataCollector());
     $this->_debugBar->addCollector(new QueryDataCollector());
     $this->_debugBar->addCollector(new MemoryCollector());
     $this->_debugBar->addCollector(new ExceptionsCollector());
     $this->_debugRender = $this->_debugBar->getJavascriptRenderer();
     $this->_debugRender->setBaseUrl($baseUrl);
 }