Total Complexity | 7 |
Total Lines | 64 |
Duplicated Lines | 0 % |
Coverage | 57.89% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | final class RulesDumper |
||
8 | { |
||
9 | private ?FormatterInterface $formatter; |
||
10 | |||
11 | 1 | public function __construct(?FormatterInterface $formatter) |
|
14 | 1 | } |
|
15 | |||
16 | /** |
||
17 | * Return all attribute rules as array. |
||
18 | * |
||
19 | * For example: |
||
20 | * |
||
21 | * ```php |
||
22 | * [ |
||
23 | * 'amount' => [ |
||
24 | * [ |
||
25 | * 'number', |
||
26 | * 'integer' => true, |
||
27 | * 'max' => 100, |
||
28 | * 'notANumberMessage' => 'Value must be an integer.', |
||
29 | * 'tooBigMessage' => 'Value must be no greater than 100.' |
||
30 | * ], |
||
31 | * ['callback'], |
||
32 | * ], |
||
33 | * 'name' => [ |
||
34 | * [ |
||
35 | * 'hasLength', |
||
36 | * 'max' => 20, |
||
37 | * 'message' => 'Value must contain at most 20 characters.' |
||
38 | * ], |
||
39 | * ], |
||
40 | * ] |
||
41 | * ``` |
||
42 | * |
||
43 | * @param iterable $rules |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | 1 | public function asArray(iterable $rules): array |
|
64 | } |
||
65 | |||
66 | public function withFormatter(?FormatterInterface $formatter): self |
||
73 |