| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function __construct(\ReflectionParameter $param, $value) |
||
| 25 | { |
||
| 26 | if(!is_string($value)) { |
||
| 27 | throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a json string. ' . gettype($value).' given.'); |
||
| 28 | } |
||
| 29 | |||
| 30 | $data = json_decode($value); |
||
| 31 | |||
| 32 | if($data === null) { |
||
| 33 | throw new Exception\InvalidArgument('Parameter '.$param->name.' expects a valid json string. ' . json_last_error_msg()); |
||
| 34 | } |
||
| 35 | |||
| 36 | return call_user_func_array(array('parent', __FUNCTION__), [$data]); |
||
| 37 | } |
||
| 38 | } |
||
| 39 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.