| 1 | <?php |
||
| 7 | class Frame |
||
| 8 | { |
||
| 9 | /** @var string */ |
||
| 10 | private $file; |
||
| 11 | |||
| 12 | /** @var int */ |
||
| 13 | private $lineNumber; |
||
| 14 | |||
| 15 | /** @var string */ |
||
| 16 | private $method; |
||
| 17 | |||
| 18 | /** @var string */ |
||
| 19 | private $class; |
||
| 20 | |||
| 21 | public function __construct( |
||
| 22 | string $file, |
||
| 23 | int $lineNumber, |
||
| 24 | string $method = null, |
||
| 25 | string $class = null |
||
| 26 | ) { |
||
| 27 | $this->file = $file; |
||
| 28 | |||
| 29 | $this->lineNumber = $lineNumber; |
||
| 30 | |||
| 31 | $this->method = $method; |
||
| 32 | |||
| 33 | $this->class = $class; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function toArray(): array |
||
| 37 | { |
||
| 38 | $codeSnippet = (new Codesnippet()) |
||
| 39 | ->snippetLineCount(9) |
||
| 40 | ->surroundingLine($this->lineNumber) |
||
| 41 | ->get($this->file); |
||
| 42 | |||
| 43 | return [ |
||
| 44 | 'line_number' => $this->lineNumber, |
||
| 45 | 'method' => $this->getFullMethod(), |
||
| 46 | 'code_snippet' => $codeSnippet, |
||
| 47 | 'file' => $this->file, |
||
| 48 | ]; |
||
| 49 | } |
||
| 50 | |||
| 51 | private function getFullMethod(): string |
||
| 61 | |||
| 62 | public function getFile(): string |
||
| 66 | } |
||
| 67 |