/** * 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)); }
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()); } }
/** * 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; }
/** * Constructor... * * @param String $file The file the event occurred within * @param Integer $line The line the call was made on * @param Array $args The arguments passed in to this call */ public function __construct($file = null, $line = null, array $args = array()) { parent::__construct($file, $line); $this->args = $args; }