Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | 21 | public function isMet($numberOfSuccess) |
|
36 | { |
||
37 | 21 | if ($this->quorum === null) { |
|
38 | 3 | throw new \RuntimeException('You must init the Quorum before querying it.'); |
|
39 | } |
||
40 | |||
41 | 18 | if ($numberOfSuccess < 0 || |
|
42 | 18 | $numberOfSuccess > $this->total) { |
|
43 | 6 | throw new \InvalidArgumentException( |
|
44 | 2 | 'Number of success cannot be inferior to zero or superior to the number of stores.' |
|
45 | 4 | ); |
|
46 | } |
||
47 | |||
48 | 12 | return $numberOfSuccess >= $this->quorum; |
|
49 | } |
||
50 | } |
||
51 |