Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | function cast($value, $config, bool $strict = false) |
||
20 | { |
||
21 | $factory = new Factory(); |
||
22 | if (\is_array($config)) { |
||
23 | /** @var TypeArrayOfType $arrayOfType */ |
||
24 | $config = ($arrayOfType = $factory->checkArrayOfType($config)) |
||
25 | ? $arrayOfType |
||
26 | : new Scheme($config, $factory, $strict); |
||
27 | } elseif (!$config instanceof CastInterface) { |
||
28 | $config = $factory->createType($config); |
||
29 | } |
||
30 | |||
31 | $cast = new Cast($config); |
||
32 | return $cast->process($value); |
||
33 | } |
||
35 |