Total Complexity | 6 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | abstract class AbstractNode extends ConfigObject implements SerializationInterface, AcceptsVisitorsInterface |
||
13 | { |
||
14 | use AcceptsVisitorsTrait; |
||
15 | use ArrayToJsonTrait; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $kind; |
||
21 | |||
22 | /** |
||
23 | * @var Location|null |
||
24 | */ |
||
25 | protected $location; |
||
26 | |||
27 | /** |
||
28 | * @return string |
||
29 | */ |
||
30 | public function getKind(): string |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return Location|null |
||
37 | */ |
||
38 | public function getLocation(): ?Location |
||
39 | { |
||
40 | return $this->location; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return array|null |
||
45 | */ |
||
46 | public function getLocationAsArray(): ?array |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return array |
||
53 | */ |
||
54 | public function toArray(): array |
||
55 | { |
||
56 | // TODO: Remove this method when every node implement its own toArray-method. |
||
57 | |||
58 | return [ |
||
59 | 'kind' => $this->kind, |
||
60 | 'loc' => $this->getLocationAsArray(), |
||
61 | ]; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return string |
||
66 | */ |
||
67 | public function __toString(): string |
||
70 | } |
||
71 | } |
||
72 |