Total Complexity | 6 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | final class IsAsAsserted implements Validation |
||
12 | { |
||
13 | public const NOT_AS_ASSERTED = 'is-as-asserted.not-as-asserted'; |
||
14 | |||
15 | /** |
||
16 | * @var callable $data -> bool |
||
17 | */ |
||
18 | private $assertion; |
||
19 | |||
20 | /** |
||
21 | * @var callable $data -> string[] |
||
22 | */ |
||
23 | private $errorFormatter; |
||
24 | |||
25 | private function __construct(callable $assertion, ?callable $errorFormatter = null) |
||
32 | }; |
||
33 | } |
||
34 | |||
35 | public static function withAssertion(callable $assertion): self |
||
36 | { |
||
37 | return new self($assertion); |
||
38 | } |
||
39 | |||
40 | public static function withAssertionAndErrorFormatter(callable $assertion, callable $errorFormatter): self |
||
41 | { |
||
42 | return new self($assertion, $errorFormatter); |
||
43 | } |
||
44 | |||
45 | public function validate($data, array $context = []): ValidationResult |
||
52 | } |
||
53 | } |
||
54 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.