We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 4 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
27 | final class Callback extends AbstractRule |
||
28 | { |
||
29 | /** |
||
30 | * @var callable |
||
31 | */ |
||
32 | private $callback; |
||
33 | |||
34 | /** |
||
35 | * @var mixed[] |
||
36 | */ |
||
37 | private $arguments; |
||
38 | |||
39 | /** |
||
40 | * Initializes the rule. |
||
41 | * |
||
42 | * @param mixed ...$arguments |
||
43 | */ |
||
44 | 7 | public function __construct(callable $callback, ...$arguments) |
|
48 | 7 | } |
|
49 | |||
50 | /** |
||
51 | * {@inheritDoc} |
||
52 | */ |
||
53 | 13 | public function validate($input): bool |
|
54 | { |
||
55 | 13 | return (bool) call_user_func_array($this->callback, $this->getArguments($input)); |
|
56 | 13 | } |
|
57 | 3 | ||
58 | /** |
||
59 | * @param mixed $input |
||
60 | 13 | * @return mixed[] |
|
61 | */ |
||
62 | private function getArguments($input): array |
||
70 | } |
||
71 | } |
||
72 |