Conditions | 5 |
Paths | 9 |
Total Lines | 19 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | protected function validateCastValue($val) |
||
12 | { |
||
13 | try { |
||
14 | if (is_string($val)) { |
||
15 | $object = json_decode($val); |
||
16 | } elseif (is_object($val)) { |
||
17 | $object = json_decode(json_encode($val)); |
||
18 | } else { |
||
19 | $object = null; |
||
20 | } |
||
21 | } catch (\Exception $e) { |
||
22 | throw $this->getValidationException($e->getMessage(), $val); |
||
23 | } |
||
24 | if (is_object($object)) { |
||
25 | return $object; |
||
26 | } else { |
||
27 | throw $this->getValidationException(null, $val); |
||
28 | } |
||
29 | } |
||
30 | |||
36 |