We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 6 |
| Paths | 8 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | 5 | public function check($input) |
|
| 50 | { |
||
| 51 | 5 | $firstException = null; |
|
| 52 | 5 | $rulesPassedCount = 0; |
|
| 53 | 5 | foreach ($this->getRules() as $rule) { |
|
| 54 | try { |
||
| 55 | 4 | $rule->check($input); |
|
| 56 | |||
| 57 | 3 | ++$rulesPassedCount; |
|
| 58 | 3 | } catch (ValidationException $exception) { |
|
| 59 | 4 | $firstException = $firstException ?: $exception; |
|
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | 5 | if ($rulesPassedCount === 1) { |
|
| 64 | 1 | return true; |
|
| 65 | } |
||
| 66 | |||
| 67 | 4 | throw $firstException ?: $this->reportError($input); |
|
| 68 | } |
||
| 69 | } |
||
| 70 |