Total Complexity | 6 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Coverage | 71.43% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
16 | final class RulesDumper |
||
17 | { |
||
18 | /** |
||
19 | * Return all attribute rules as array. |
||
20 | * |
||
21 | * For example: |
||
22 | * |
||
23 | * ```php |
||
24 | * [ |
||
25 | * 'amount' => [ |
||
26 | * [ |
||
27 | * 'number', |
||
28 | * 'integer' => true, |
||
29 | * 'max' => 100, |
||
30 | * 'notANumberMessage' => 'Value must be an integer.', |
||
31 | * 'tooBigMessage' => 'Value must be no greater than 100.' |
||
32 | * ], |
||
33 | * ['callback'], |
||
34 | * ], |
||
35 | * 'name' => [ |
||
36 | * [ |
||
37 | * 'hasLength', |
||
38 | * 'max' => 20, |
||
39 | * 'message' => 'Value must contain at most 20 characters.' |
||
40 | * ], |
||
41 | * ], |
||
42 | * ] |
||
43 | * ``` |
||
44 | * |
||
45 | * @param iterable $rules |
||
46 | */ |
||
47 | 6 | public function asArray(iterable $rules): array |
|
50 | } |
||
51 | |||
52 | 6 | private function fetchOptions(iterable $rules): array |
|
74 |