| Conditions | 9 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 15.3773 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | 1 | protected function _parse(&$variable) |
|
| 18 | { |
||
| 19 | if ( |
||
| 20 | 1 | is_object($variable) |
|
| 21 | 1 | || is_array($variable) |
|
| 22 | 1 | || (string)$variable !== $variable |
|
| 23 | 1 | || !isset($variable[0]) |
|
| 24 | 1 | || ($variable[0] !== '{' && $variable[0] !== '[') |
|
| 25 | 1 | || ($json = json_decode($variable, true)) === null |
|
| 26 | ) { |
||
| 27 | 1 | return false; |
|
| 28 | } |
||
| 29 | |||
| 30 | $val = (array)$json; |
||
| 31 | if (empty($val)) { |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | $this->value = KintParser::factory($val)->extendedValue; |
||
|
|
|||
| 36 | $this->type = 'JSON'; |
||
| 37 | |||
| 38 | return true; |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..