Total Complexity | 7 |
Total Lines | 82 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class Location implements SerializationInterface |
||
9 | { |
||
10 | use ArrayToJsonTrait; |
||
11 | |||
12 | /** |
||
13 | * @var int |
||
14 | */ |
||
15 | protected $start; |
||
16 | |||
17 | /** |
||
18 | * @var int |
||
19 | */ |
||
20 | protected $end; |
||
21 | |||
22 | /** |
||
23 | * @var Source|null |
||
24 | */ |
||
25 | protected $source; |
||
26 | |||
27 | /** |
||
28 | * Location constructor. |
||
29 | * |
||
30 | * @param int $start |
||
31 | * @param int $end |
||
32 | * @param Source|null $source |
||
33 | */ |
||
34 | public function __construct(int $start, int $end, ?Source $source = null) |
||
35 | { |
||
36 | $this->start = $start; |
||
37 | $this->end = $end; |
||
38 | $this->source = $source; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return int |
||
43 | */ |
||
44 | public function getStart(): int |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @return int |
||
51 | */ |
||
52 | public function getEnd(): int |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function hasSource(): bool |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * @return Source|null |
||
67 | */ |
||
68 | public function getSource(): ?Source |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @return array |
||
75 | */ |
||
76 | public function toArray(): array |
||
81 | ]; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @return string |
||
86 | */ |
||
87 | public function __toString(): string |
||
92 |