| Total Complexity | 7 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Coverage | 57.89% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | final class RulesDumper |
||
| 19 | { |
||
| 20 | private ?FormatterInterface $formatter; |
||
| 21 | |||
| 22 | 1 | public function __construct(?FormatterInterface $formatter) |
|
| 25 | 1 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Return all attribute rules as array. |
||
| 29 | * |
||
| 30 | * For example: |
||
| 31 | * |
||
| 32 | * ```php |
||
| 33 | * [ |
||
| 34 | * 'amount' => [ |
||
| 35 | * [ |
||
| 36 | * 'number', |
||
| 37 | * 'integer' => true, |
||
| 38 | * 'max' => 100, |
||
| 39 | * 'notANumberMessage' => 'Value must be an integer.', |
||
| 40 | * 'tooBigMessage' => 'Value must be no greater than 100.' |
||
| 41 | * ], |
||
| 42 | * ['callback'], |
||
| 43 | * ], |
||
| 44 | * 'name' => [ |
||
| 45 | * [ |
||
| 46 | * 'hasLength', |
||
| 47 | * 'max' => 20, |
||
| 48 | * 'message' => 'Value must contain at most 20 characters.' |
||
| 49 | * ], |
||
| 50 | * ], |
||
| 51 | * ] |
||
| 52 | * ``` |
||
| 53 | * |
||
| 54 | * @param iterable $rules |
||
| 55 | * |
||
| 56 | * @return array |
||
| 57 | */ |
||
| 58 | 1 | public function asArray(iterable $rules): array |
|
| 75 | } |
||
| 76 | |||
| 77 | public function withFormatter(?FormatterInterface $formatter): self |
||
| 84 |