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