Conditions | 8 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 8.0877 |
Changes | 0 |
1 | <?php |
||
22 | 6 | private function processCasting(Attribute $attribute, $value) |
|
23 | { |
||
24 | 6 | if (($castFunction = $attribute->getCast()) !== null && is_callable($castFunction)) |
|
25 | 2 | return $castFunction($value); |
|
26 | |||
27 | 6 | if ((($type = $attribute->getCast()) !== null && is_string($type)) || |
|
28 | 6 | (is_string($type = $attribute->cast(null)) && in_array(strtolower($type), ["bool", "boolean", "string", "double", "float", "int", "integer", "array", "object"]))) { |
|
29 | 2 | return $this->castFromString($type, $value); |
|
30 | } |
||
31 | |||
32 | 4 | if (!($attribute->cast(null) instanceof Attribute)) |
|
33 | return $attribute->cast($value); |
||
34 | |||
35 | 4 | return $value; |
|
36 | } |
||
62 |