| Total Complexity | 8 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class Caller |
||
| 8 | { |
||
| 9 | protected $ignorePath = [__FILE__]; |
||
| 10 | protected $backtrace; |
||
| 11 | |||
| 12 | public function __construct(array $backtrace, array $ignorePath =[]) |
||
| 13 | { |
||
| 14 | $this->ignorePath = \array_merge($this->ignorePath, $ignorePath); |
||
| 15 | $this->backtrace = $backtrace; |
||
| 16 | } |
||
| 17 | |||
| 18 | public function getCallerTrace():?array |
||
| 19 | { |
||
| 20 | foreach ($this->backtrace as $trace) { |
||
| 21 | if (array_key_exists('file', $trace)) { |
||
| 22 | if (!$this->isIgnore($trace['file'])) { |
||
| 23 | return $trace; |
||
| 24 | } |
||
| 25 | } |
||
| 26 | } |
||
| 27 | return null; |
||
| 28 | } |
||
| 29 | |||
| 30 | protected function isIgnore(string $file):bool { |
||
| 37 | } |
||
| 38 | } |
||
| 39 |