1 | <?php |
||
18 | class LineRange |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | private $startLineNumber; |
||
25 | |||
26 | /** |
||
27 | * @var int |
||
28 | */ |
||
29 | private $endLineNumber; |
||
30 | |||
31 | /** |
||
32 | * @param int $startLineNumber |
||
33 | * @param int $endLineNumber |
||
34 | */ |
||
35 | public function __construct($startLineNumber, $endLineNumber) |
||
36 | { |
||
37 | $this->startLineNumber = $startLineNumber; |
||
38 | $this->endLineNumber = $endLineNumber; |
||
39 | $this->validate(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return int |
||
44 | */ |
||
45 | public function getStartLineNumber() |
||
49 | |||
50 | /** |
||
51 | * @return int |
||
52 | */ |
||
53 | public function getEndLineNumber() |
||
57 | |||
58 | /** |
||
59 | * @param int $lineNumber |
||
60 | * @return bool |
||
61 | */ |
||
62 | public function contains($lineNumber) |
||
69 | |||
70 | /** |
||
71 | * @throws UnexpectedLineNumberException |
||
72 | * @throws LessThanLineNumberException |
||
73 | */ |
||
74 | private function validate() |
||
79 | |||
80 | /** |
||
81 | * @throws UnexpectedLineNumberException |
||
82 | */ |
||
83 | private function validateLineNumber() |
||
99 | |||
100 | /** |
||
101 | * @throws LessThanLineNumberException |
||
102 | */ |
||
103 | private function validateLineRange() |
||
118 | |||
119 | } |
||
120 |