| 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 |
||
| 29 | 12 | public function isMet($numberOfSuccess) |
|
| 30 | { |
||
| 31 | 12 | if ($this->quorum === null) { |
|
| 32 | 3 | throw new \RuntimeException('You must init the Quorum before querying it.'); |
|
| 33 | } |
||
| 34 | |||
| 35 | 9 | if ($numberOfSuccess < 0 || |
|
| 36 | 9 | $numberOfSuccess > $this->quorum) { |
|
| 37 | 6 | throw new \InvalidArgumentException( |
|
| 38 | 2 | 'Number of success cannot be inferior to zero or superior to the number of stores.' |
|
| 39 | 4 | ); |
|
| 40 | } |
||
| 41 | |||
| 42 | 3 | return $numberOfSuccess === $this->quorum; |
|
| 43 | } |
||
| 44 | } |
||
| 45 |