Total Complexity | 8 |
Total Lines | 89 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class Symbol implements SymbolInterface, LexemeInterface |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var int |
||
17 | */ |
||
18 | private $offset; |
||
19 | |||
20 | /** |
||
21 | * @var int |
||
22 | */ |
||
23 | private $code; |
||
24 | |||
25 | /** |
||
26 | * @var LexemeInterface |
||
27 | */ |
||
28 | private $constituentLexeme; |
||
29 | |||
30 | 9 | public function __construct(int $offset, int $code, LexemeInterface $constituentLexeme) |
|
31 | { |
||
32 | 9 | $this->offset = $offset; |
|
33 | 9 | $this->code = $code; |
|
34 | 9 | $this->constituentLexeme = $constituentLexeme; |
|
35 | 9 | } |
|
36 | |||
37 | /** |
||
38 | * @return int |
||
39 | * @psalm-pure |
||
40 | */ |
||
41 | 1 | public function getOffset(): int |
|
42 | { |
||
43 | 1 | return $this->offset; |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return int |
||
48 | * @psalm-pure |
||
49 | */ |
||
50 | 1 | public function getCode(): int |
|
51 | { |
||
52 | 1 | return $this->code; |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return LexemeInterface |
||
57 | * @psalm-pure |
||
58 | */ |
||
59 | 1 | public function getLexeme(): LexemeInterface |
|
60 | { |
||
61 | 1 | return $this; |
|
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return SymbolInterface[] |
||
66 | * @psalm-return array<int,SymbolInterface> |
||
67 | * @psalm-pure |
||
68 | */ |
||
69 | 1 | public function getSymbols(): array |
|
70 | { |
||
71 | 1 | return [$this]; |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @return LexemeInterface |
||
76 | * @spalm-pure |
||
77 | */ |
||
78 | 1 | public function getConstituentLexeme(): LexemeInterface |
|
79 | { |
||
80 | 1 | return $this->constituentLexeme; |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * @return int[] |
||
85 | * @psalm-return array<int,int> |
||
86 | * @psalm-pure |
||
87 | */ |
||
88 | 2 | public function getStartOffsets(): array |
|
91 | } |
||
92 | |||
93 | /** |
||
94 | * @return int[] |
||
95 | * @psalm-return array<int,int> |
||
96 | * @psalm-pure |
||
97 | */ |
||
98 | 2 | public function getFinishOffsets(): array |
|
101 | } |
||
102 | } |
||
103 |