| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 23 | protected function determineCast($key, $value) : string |
||
| 24 | { |
||
| 25 | $cast = is_string($key) ? $value : 'string'; |
||
| 26 | |||
| 27 | $availableCasts = [ |
||
| 28 | 'string', |
||
| 29 | 'bool', |
||
| 30 | 'integer', |
||
| 31 | 'float', |
||
| 32 | 'array', |
||
| 33 | ]; |
||
| 34 | |||
| 35 | if (!in_array($cast, $availableCasts)) { |
||
| 36 | throw InvalidCast::make($cast, $availableCasts); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $cast; |
||
| 40 | } |
||
| 41 | } |
||
| 42 |