/** * Tests the Debug::getVersion * * @issue 12215 * @author Serghei Iakovlev <*****@*****.**> * @since 2016-09-25 */ public function testShouldGetVersion() { $this->specify("The getVersion doesn't work as expected", function () { $debug = new Debug(); $target = '"_new"'; $uri = '"https://docs.phalconphp.com/en/' . Version::getPart(Version::VERSION_MAJOR) . '.0.0/"'; $version = Version::get(); expect($debug->getVersion())->equals("<div class='version'>Phalcon Framework <a href={$uri} target={$target}>{$version}</a></div>"); }); }
private function _registerServices() { $debug = new ModeDebug(); $debug->listen(Phalcon_Debug); $this->manager = new ApplicationManager(); $this->include_file('autoloader.php'); // Autoload Service $this->include_file('routers.php'); // Read Router $this->include_file('services.php'); // Read services $this->setDI($this->manager); }
private function _registerServices() { $debug = new ModeDebug(); $debug->listen(Phalcon_Debug); $manager = new ApplicationManager(); include_once $this->pathConfig . '/autoloader.php'; // Read auto-loader include_once $this->pathConfig . '/routers.php'; // Read Router include_once $this->pathConfig . '/services.php'; // Read services $this->setDI($manager); }
/** * 重写异常处理方法 * * @param \Exception $e * @return \Matrix\Http\json */ public function onUncaughtException(\Exception $e) { //判断是否为参数验证错误 if ($e instanceof ValidationException) { $errors = json_decode($e->getMessage(), true); return (new Response())->detail($errors); } //当前应用为 service 类型服务,直接输出错误信息 if (self::$appType === 'service') { echo $e->getMessage(); exit; } //当前应用为 api 类型服务,输出 api 格式返回信息 if (self::$appType === 'api') { return (new Response())->apiDetail($e->getMessage()); } //web H5 返回错误页面 parent::onUncaughtException($e); }
/** * Initializes debug * * @param array $options */ protected function initDebug($options = array()) { $config = $this->di['config']; // Create the new object $debug = new PhDebug(); // Store it in the Di container // Settings cones from the include if ('1' == $config->application->debug) { $debug->listen(); } $this->di['debug'] = $debug; }
<?php use Phalcon\Debug, Phalcon\Mvc\Micro, Phalcon\Exception; /* debug settings */ error_reporting(E_ALL); $debug = new Debug(); $debug->listen(); /* include config files */ $config = (require __DIR__ . '/config/config.php'); $config->merge(require __DIR__ . '/config/database.php'); require __DIR__ . '/config/loader.php'; require __DIR__ . '/config/services.php'; /* app */ try { $app = new Micro($di); require __DIR__ . '/users.php'; $app->handle(); } catch (Exception $e) { echo "Phalcon: " . $e->getMessage(); } catch (PDOException $e) { echo "PDO: " . $e->getMessage(); }
/** * @return Debug */ public function getDebugger() { if ($this->debugger) { return $this->debugger; } $debugger = new Debug(); $debugger->setShowFileFragment(true); $debugger->listen(true, true); return $this->debugger = $debugger; }
/** * * @param type $options */ protected function initEnvironment($options = []) { $config = $this->_di->get('config'); $environment = $config->application->environment != 'production' ? true : false; if ($environment) { ini_set('display_errors', true); $debug = new Debug(); $debug->listen(); } else { ini_set('display_errors', false); error_reporting(-1); } set_error_handler(['\\SysPhalcon\\Plugins\\Error', 'normal']); set_exception_handler(['SysPhalcon\\Plugins\\Error', 'exception']); register_shutdown_function(['SysPhalcon\\Plugins\\Error', 'shutdown']); }