Total Complexity | 11 |
Total Lines | 77 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | final class PositionConstraint |
||
10 | { |
||
11 | /** |
||
12 | * @var int First position. |
||
13 | */ |
||
14 | private $first; |
||
15 | |||
16 | /** |
||
17 | * @var int|null Number of positions. |
||
18 | */ |
||
19 | private $count; |
||
20 | |||
21 | /** |
||
22 | * @var int Constraint weight. |
||
23 | */ |
||
24 | private $weight; |
||
25 | |||
26 | /** |
||
27 | * @param int $first First position. |
||
28 | * @param int|null $count Number of positions. |
||
29 | * @param int $weight Constraint weight. |
||
30 | */ |
||
31 | 9 | public function __construct(int $first = 0, ?int $count = null, int $weight = 1) |
|
43 | 6 | } |
|
44 | |||
45 | /** |
||
46 | * @return int First position. |
||
47 | */ |
||
48 | 1 | public function getFirst(): int |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return int|null Number of positions. |
||
55 | */ |
||
56 | 1 | public function getCount(): ?int |
|
57 | { |
||
58 | 1 | return $this->count; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return int Constraint weight. |
||
63 | */ |
||
64 | 1 | public function getWeight(): int |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * Check whether the position is in compliance with the constraint. |
||
71 | * |
||
72 | * @param int $pos Position to check. |
||
73 | * @return bool Whether the position is in compliance with the constraint. |
||
74 | */ |
||
75 | 4 | public function test(int $pos): bool |
|
88 |