| Total Complexity | 13 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 13 | abstract class BaseToken |
||
| 14 | { |
||
| 15 | abstract public function getType(): TokenType; |
||
| 16 | |||
| 17 | public function __construct( |
||
| 18 | private readonly mixed $value, |
||
|
|
|||
| 19 | private readonly int $offset = 0, |
||
| 20 | ) { |
||
| 21 | } |
||
| 22 | 336 | ||
| 23 | public function getValue(): mixed |
||
| 24 | 336 | { |
|
| 25 | 336 | return $this->value; |
|
| 26 | 336 | } |
|
| 27 | |||
| 28 | 286 | final public function getOriginalValue(): mixed |
|
| 29 | { |
||
| 30 | 286 | return $this->value; |
|
| 31 | } |
||
| 32 | |||
| 33 | 154 | public function getOffset(): int |
|
| 34 | { |
||
| 35 | 154 | return $this->offset; |
|
| 36 | } |
||
| 37 | |||
| 38 | 90 | /** @throws ParserException */ |
|
| 39 | public function createNode(TokenIterator $tokenStream): self |
||
| 40 | 90 | { |
|
| 41 | return $this; |
||
| 42 | } |
||
| 43 | |||
| 44 | 238 | public function isOfType(TokenType $type): bool |
|
| 45 | { |
||
| 46 | 238 | return $this->getType() === $type; |
|
| 47 | } |
||
| 48 | |||
| 49 | 270 | public function canBeIgnored(): bool |
|
| 50 | { |
||
| 51 | 270 | return |
|
| 52 | $this->isOfType(TokenType::SPACE) || |
||
| 53 | $this->isOfType(TokenType::COMMENT); |
||
| 54 | 174 | } |
|
| 55 | } |
||
| 56 |