Example #1
0
 /**
  * Returns the backtrace trace details for a given offset
  *
  * @param integer $offset The offset of the trace
  * @param integer $wrapFlag The offset wrapping mode to use
  * @return array A list of the backtrace details at the given offset
  */
 public function getTraceByOffset($offset, $wrapFlag = \r8\num\OFFSET_RESTRICT)
 {
     $trace = $this->getTrace();
     if (count($trace) <= 0) {
         return NULL;
     }
     return \r8\Backtrace\Event::from(\r8\ary\offset($trace, $offset, $wrapFlag));
 }
Example #2
0
 public function testFrom_Invalid()
 {
     try {
         \r8\Backtrace\Event::from(array('class' => "blah"));
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\Argument $err) {
         $this->assertSame("Invalid event format", $err->getMessage());
     }
 }
Example #3
0
 /**
  * Constructs a new backtrace from an debug_backtrace array
  *
  * @param Array $backtrace The backtrace array to build from
  * @return \r8\Backtrace
  */
 public static function from(array $backtrace)
 {
     $result = new self();
     foreach ($backtrace as $event) {
         if (is_array($event)) {
             $result->pushEvent(\r8\Backtrace\Event::from($event));
         }
     }
     $result->pushEvent(new \r8\Backtrace\Event\Main(\r8\Env::request()->getFile()->getPath()));
     return $result;
 }