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