Total Complexity | 3 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class TokenizerException extends \Nette\Tokenizer\Exception |
||
14 | { |
||
15 | private ?Token $currentToken = null; |
||
16 | |||
17 | /** |
||
18 | * Invalid value path exception. |
||
19 | * |
||
20 | * @param string $message Exception message. |
||
21 | * @param Tokenizer\Stream|null $stream Tokenizer stream. |
||
22 | * @param int $code Exception code. |
||
23 | * @param \Throwable|null $previous Previous exception. |
||
24 | */ |
||
25 | public function __construct( |
||
26 | $message, |
||
27 | ?Tokenizer\Stream $stream = null, |
||
28 | int $code = 0, |
||
29 | \Throwable $previous = null |
||
30 | ) { |
||
31 | parent::__construct($message, $code, $previous); |
||
32 | |||
33 | if ($stream !== null) { |
||
34 | $this->currentToken = $stream->currentToken(); |
||
35 | } |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Get token at which exception was thrown. |
||
40 | * |
||
41 | * @return Token|null |
||
42 | */ |
||
43 | public function getCurrentToken(): ?Token |
||
46 | } |
||
47 | } |
||
48 |