/** * Display an error. * * Template method of BaseErrorHandler. * * Only when debug > 2 will a formatted error be displayed. * * @param array $error An array of error data. * @param bool $debug Whether or not the app is in debug mode. * @return void */ protected function _displayError($error, $debug) { if (!$debug) { return; } Debugger::getInstance()->outputError($error); }
/** * Switches output format, updates format strings. * Can be used to switch the active output format: * * @param string $format Format to use, including 'js' for JavaScript-enhanced HTML, 'html' for * straight HTML output, or 'txt' for unformatted text. * @param array $strings Template strings to be used for the output format. * @return string * @deprecated Use Debugger::outputAs() and Debugger::addFormat(). Will be removed * in 3.0 */ public function output($format = null, array $strings = array()) { $self = Debugger::getInstance(); $data = null; if ($format === null) { return Debugger::outputAs(); } if (!empty($strings)) { return Debugger::addFormat($format, $strings); } if ($format === true && !empty($self->_data)) { $data = $self->_data; $self->_data = array(); $format = false; } Debugger::outputAs($format); return $data; }
/** * test getInstance. * * @return void */ public function testGetInstance() { $result = Debugger::getInstance(); $this->assertInstanceOf('Cake\\Utility\\Debugger', $result); $result = Debugger::getInstance(__NAMESPACE__ . '\\DebuggerTestCaseDebugger'); $this->assertInstanceOf(__NAMESPACE__ . '\\DebuggerTestCaseDebugger', $result); $result = Debugger::getInstance(); $this->assertInstanceOf(__NAMESPACE__ . '\\DebuggerTestCaseDebugger', $result); $result = Debugger::getInstance('Cake\\Utility\\Debugger'); $this->assertInstanceOf('Cake\\Utility\\Debugger', $result); }