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 | 54 |
Duplicated Lines | 0 % |
Coverage | 84.62% |
Changes | 0 |
1 | <?php |
||
19 | class Not extends AbstractRule |
||
20 | { |
||
21 | public $rule; |
||
22 | |||
23 | 10 | public function __construct(Validatable $rule) |
|
24 | { |
||
25 | 10 | $this->rule = $rule; |
|
26 | 10 | } |
|
27 | |||
28 | 5 | public function setName($name) |
|
33 | } |
||
34 | |||
35 | 4 | public function validate($input): bool |
|
38 | } |
||
39 | |||
40 | 4 | public function assert($input): void |
|
41 | { |
||
42 | 4 | if ($this->validate($input)) { |
|
43 | return; |
||
44 | } |
||
45 | |||
46 | 4 | $rule = $this->rule; |
|
47 | 4 | if ($rule instanceof AllOf) { |
|
48 | 2 | $rule = $this->absorbAllOf($rule, $input); |
|
49 | } |
||
50 | |||
51 | throw $rule |
||
52 | 4 | ->reportError($input) |
|
53 | 4 | ->setMode(ValidationException::MODE_NEGATIVE); |
|
54 | } |
||
55 | |||
56 | 2 | private function absorbAllOf(AllOf $rule, $input) |
|
73 | } |
||
74 | } |
||
75 |