Beispiel #1
0
 public static function __callStatic($priority = 'debug', $params = array())
 {
     $trace = Debugger::trace(array('format' => 'array', 'depth' => 3, 'includeScope' => false));
     $trace = $trace[2];
     if (empty($trace)) {
         throw UnexpectedValueException('Could not trace method');
     }
     $trace = array('method' => $trace['functionRef'], 'line' => $trace['line'], 'file' => $trace['file']);
     $message = "//////////// {$trace['file']}:{$trace['line']} -> {$trace['method']} ////////////\n";
     foreach ($params as $param) {
         $dump = Debugger::export($param);
         $message = "{$message}{$dump}\n";
     }
     return parent::write($priority, $message);
 }
Beispiel #2
0
 /**
  * Convert an exception object to an exception result array for test reporting.
  *
  * @param array $exception The exception data to report on. Statistics are gathered and
  *               added to the reporting stack contained in `Unit::$_results`.
  * @param string $lineFlag
  * @return void
  * @todo Refactor so that reporters handle trace formatting.
  */
 protected function _reportException($exception, $lineFlag = null)
 {
     $message = $exception['message'];
     $isExpected = ($exp = end($this->_expected)) && ($exp === true || $exp === $message || Validator::isRegex($exp) && preg_match($exp, $message));
     if ($isExpected) {
         return array_pop($this->_expected);
     }
     $initFrame = current($exception['trace']) + array('class' => '-', 'function' => '-');
     foreach ($exception['trace'] as $frame) {
         if (isset($scopedFrame)) {
             break;
         }
         if (!class_exists('lithium\\analysis\\Inspector')) {
             continue;
         }
         if (isset($frame['class']) && in_array($frame['class'], Inspector::parents($this))) {
             $scopedFrame = $frame;
         }
     }
     if (class_exists('lithium\\analysis\\Debugger')) {
         $exception['trace'] = Debugger::trace(array('trace' => $exception['trace'], 'format' => '{:functionRef}, line {:line}', 'includeScope' => false, 'scope' => array_filter(array('functionRef' => __NAMESPACE__ . '\\{closure}', 'line' => $lineFlag))));
     }
     $this->_result('exception', $exception + array('class' => $initFrame['class'], 'method' => $initFrame['function']));
 }
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */
use lithium\analysis\Debugger;
use lithium\analysis\Inspector;
$exception = $info['exception'];
$replace = array('&lt;?php', '?&gt;', '<code>', '</code>', "\n");
$context = 5;
/**
 * Set Lithium-esque colors for syntax highlighing.
 */
ini_set('highlight.string', '#4DDB4A');
ini_set('highlight.comment', '#D42AAE');
ini_set('highlight.keyword', '#D42AAE');
ini_set('highlight.default', '#3C96FF');
ini_set('highlight.htm', '#FFFFFF');
$stack = Debugger::trace(array('format' => 'array', 'trace' => $exception->getTrace()));
array_unshift($stack, array('functionRef' => '[exception]', 'file' => $exception->getFile(), 'line' => $exception->getLine()));
?>
<h3>Exception</h3>

<div class="lithium-exception-class">
    <?php 
echo get_class($exception);
?>

    <?php 
if ($code = $exception->getCode()) {
    ?>
        <span class="code">(code <?php 
    echo $code;
    ?>
Beispiel #4
0
 /**
  * Convert an exception object to an exception result array for test reporting.
  *
  * @param object $exception The exception object to report on. Statistics are gathered and
  *               added to the reporting stack contained in `Unit::$_results`.
  * @param string $lineFlag
  * @return void
  * @todo Refactor so that reporters handle trace formatting.
  */
 protected function _reportException($exception, $lineFlag = null)
 {
     $initFrame = current($exception['trace']) + array('class' => '-', 'function' => '-');
     foreach ($exception['trace'] as $frame) {
         if (isset($scopedFrame)) {
             break;
         }
         if (!class_exists('lithium\\analysis\\Inspector')) {
             continue;
         }
         if (isset($frame['class']) && in_array($frame['class'], Inspector::parents($this))) {
             $scopedFrame = $frame;
         }
     }
     $trace = $exception['trace'];
     unset($exception['trace']);
     $this->_result('exception', $exception + array('class' => $initFrame['class'], 'method' => $initFrame['function'], 'trace' => Debugger::trace(array('trace' => $trace, 'format' => '{:functionRef}, line {:line}', 'includeScope' => false, 'scope' => array_filter(array('functionRef' => __NAMESPACE__ . '\\{closure}', 'line' => $lineFlag))))));
 }