/** * Enables the debug tools. * * This method registers an error handler and an exception handler. * * If the Symfony ClassLoader component is available, a special * class loader is also registered. */ protected function enableDebug() { error_reporting(-1); ErrorHandler::register($this->errorReportingLevel); if ('cli' !== php_sapi_name()) { $handler = ExceptionHandler::register(); $handler->setAppVersion($this->getVersion()); } elseif (!ini_get('log_errors') || ini_get('error_log')) { ini_set('display_errors', 1); } if (class_exists('Symfony\\Component\\ClassLoader\\DebugClassLoader')) { DebugClassLoader::enable(); } }
/** * Run the boot process, load our modules and their dependencies. * * This method is automatically called by dispatch(), but you can use it * to build all services when not handling a request. * * @return $this */ public function boot() { if (true === $this->booted) { return $this; } if ($this->isDebug()) { ExceptionHandler::register(true, 'UTF-8', 'PPI Framework', self::VERSION, true); } $this->serviceManager = $this->buildServiceManager(); $this->log('debug', sprintf('Booting %s ...', $this->name)); // Loading our Modules $this->getModuleManager()->loadModules(); if ($this->debug) { $modules = $this->getModuleManager()->getModules(); $this->log('debug', sprintf('All modules online (%d): "%s"', count($modules), implode('", "', $modules))); } // Lets get all the services our of our modules and start setting them in the ServiceManager $moduleServices = $this->serviceManager->get('ModuleDefaultListener')->getServices(); foreach ($moduleServices as $key => $service) { $this->serviceManager->setFactory($key, $service); } $this->booted = true; if ($this->debug) { $this->log('debug', sprintf('%s has booted (in %.3f secs)', $this->name, microtime(true) - $this->startTime)); } return $this; }