コード例 #1
0
ファイル: Throwable.php プロジェクト: evoke-php/evoke-php
 /**
  * @inheritDoc
  */
 public function get()
 {
     if (!isset($this->throwable)) {
         throw new LogicException('Throwable must be set to get view.');
     }
     ob_start();
     var_dump($this->throwable->getTrace());
     $fullTrace = ob_get_clean();
     // If xdebug is installed then var_dump is pretty printed for html already.
     if (function_exists('xdebug_var_dump')) {
         $viewTrace = new Text();
         $viewTrace->setHTML5($fullTrace);
         $fullTrace = ['div', ['class' => 'full_trace'], $viewTrace->get()];
     } else {
         $fullTrace = ['pre', ['class' => 'full_trace'], $fullTrace];
     }
     return ['div', ['class' => 'Throwable'], [['div', ['class' => 'location'], 'Thrown at ' . $this->throwable->getFile() . ' line ' . $this->throwable->getLine()], ['pre', [], $this->throwable->getMessage()], ['h2', [], 'Basic Trace'], ['pre', ['class' => 'basic_trace'], $this->throwable->getTraceAsString()], ['h2', [], 'Full Trace'], $fullTrace]];
 }
コード例 #2
0
ファイル: ThrowableTest.php プロジェクト: evoke-php/evoke-php
 /**
  * Unset throwable causes throw.
  *
  * @covers            Evoke\View\HTML5\Throwable::get
  * @expectedException LogicException
  */
 public function testUnsetException()
 {
     $object = new Throwable();
     $object->get();
 }