Total Complexity | 9 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
5 | class Result |
||
6 | { |
||
7 | private $size; |
||
8 | private $duration; |
||
9 | private $hasSolution; |
||
10 | |||
11 | /** |
||
12 | * @param int $size |
||
13 | * @param int $duration |
||
14 | * @param bool $hasSolution |
||
15 | */ |
||
16 | 19 | public function __construct($size, $duration, $hasSolution) |
|
21 | 6 | } |
|
22 | |||
23 | 4 | public function getSize() |
|
24 | { |
||
25 | 4 | return $this->size; |
|
26 | } |
||
27 | |||
28 | 4 | public function getDuration() |
|
29 | { |
||
30 | 4 | return $this->duration; |
|
31 | } |
||
32 | |||
33 | 5 | public function hasSolution() |
|
36 | } |
||
37 | |||
38 | 19 | private function filterSize($size) |
|
39 | { |
||
40 | 19 | $naturalNumber = filter_var($size, FILTER_VALIDATE_INT, array('options' => array('min_range' => 1))); |
|
41 | |||
42 | 19 | if ($naturalNumber === false) { |
|
43 | 6 | throw new \InvalidArgumentException('Invalid size: ' . print_r($size, true)); |
|
|
|||
44 | } |
||
45 | |||
46 | 13 | return $naturalNumber; |
|
47 | } |
||
48 | |||
49 | 13 | private function filterDuration($duration) |
|
50 | { |
||
51 | 13 | $nonNegativeInteger = filter_var($duration, FILTER_VALIDATE_INT, array('options' => array('min_range' => 0))); |
|
52 | |||
53 | 13 | if ($nonNegativeInteger === false) { |
|
54 | 7 | throw new \InvalidArgumentException('Invalid duration: ' . print_r($duration, true)); |
|
55 | } |
||
56 | |||
57 | 6 | return $nonNegativeInteger; |
|
58 | } |
||
59 | |||
60 | 6 | private function filterHasSolution($hasSolution) |
|
63 | } |
||
64 | } |
||
65 |