| Conditions | 6 |
| Paths | 8 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 65 | public function cast($value): array |
||
| 66 | { |
||
| 67 | $result = []; |
||
| 68 | $config = $this->config; |
||
| 69 | foreach ((array)$value as $key => $itemValue) { |
||
| 70 | if (isset($config[$key])) { |
||
| 71 | $result[$key] = $config[$key]->cast($itemValue); |
||
| 72 | unset($config[$key]); |
||
| 73 | } elseif (!$this->strict) { |
||
| 74 | $result[$key] = $itemValue; |
||
| 75 | } |
||
| 76 | } |
||
| 77 | |||
| 78 | if ($this->strict) { |
||
| 79 | foreach ($config as $key => $type) { |
||
| 80 | $result[$key] = $type->cast(null); |
||
| 81 | } |
||
| 82 | } |
||
| 83 | |||
| 84 | return $result; |
||
| 85 | } |
||
| 87 |