| 1 | <?php |
||
| 9 | class Error |
||
| 10 | { |
||
| 11 | |||
| 12 | protected $_exception; |
||
| 13 | protected $_message; |
||
| 14 | protected $_firstTraceFile; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param \Exception $e |
||
| 18 | */ |
||
| 19 | public function __construct(\Exception $e) |
||
| 20 | { |
||
| 21 | $this->_message = $e->getMessage(); |
||
| 22 | $this->_firstTraceFile = $this->setFirstTraceFile($e); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param \Exception $exception |
||
| 27 | * @return mixed |
||
| 28 | */ |
||
| 29 | protected function setFirstTraceFile(\Exception $exception) |
||
| 30 | { |
||
| 31 | foreach ($exception->getTrace() as $trace) { |
||
| 32 | return $trace['file']; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return string |
||
| 38 | */ |
||
| 39 | public function getFirstTraceFile() |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | public function getMessage() |
||
| 51 | |||
| 52 | } |
||
| 53 |