| Total Complexity | 21 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Coverage | 81.58% |
| Changes | 3 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 7 | trait ResolveCasting |
||
| 8 | { |
||
| 9 | 68 | protected function resolveAttributeCasting(array $data) |
|
| 10 | { |
||
| 11 | 68 | return collect($this->rules()) |
|
|
|
|||
| 12 | 68 | ->filter(function ($rule) { |
|
| 13 | 23 | return $rule instanceof Attribute; |
|
| 14 | 68 | }) |
|
| 15 | 68 | ->intersectByKeys($data)->map(function (Attribute $attribute, $key) use ($data) { |
|
| 16 | 6 | return $this->processCasting($attribute, $data[$key]); |
|
| 17 | 68 | })->toArray(); |
|
| 18 | } |
||
| 19 | |||
| 20 | 6 | private function processCasting(Attribute $attribute, $value) |
|
| 40 | } |
||
| 41 | |||
| 42 | 3 | private function castFromString(string $type, $value) |
|
| 63 | } |
||
| 64 | } |
||
| 66 |