We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 10 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Coverage | 96.3% |
Changes | 0 |
1 | <?php |
||
19 | class Not extends AbstractRule |
||
20 | { |
||
21 | public $rule; |
||
22 | |||
23 | 101 | public function __construct(Validatable $rule) |
|
24 | { |
||
25 | 101 | $this->rule = $rule; |
|
26 | 101 | } |
|
27 | |||
28 | 5 | public function setName($name) |
|
33 | } |
||
34 | |||
35 | 95 | public function validate($input): bool |
|
38 | } |
||
39 | |||
40 | 93 | public function assert($input): void |
|
41 | { |
||
42 | 93 | if ($this->validate($input)) { |
|
43 | 2 | return; |
|
44 | } |
||
45 | |||
46 | 91 | $rule = $this->rule; |
|
47 | 91 | if ($rule instanceof AllOf) { |
|
48 | 89 | $rule = $this->absorbAllOf($rule, $input); |
|
49 | } |
||
50 | |||
51 | 91 | $exception = $rule->reportError($input); |
|
52 | 91 | $exception->updateMode(ValidationException::MODE_NEGATIVE); |
|
53 | |||
54 | 91 | throw $exception; |
|
55 | } |
||
56 | |||
57 | 89 | private function absorbAllOf(AllOf $rule, $input) |
|
74 | } |
||
75 | } |
||
76 |