| Conditions | 6 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 6 |
| Changes | 4 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 51 | 2 | public static function getFromArrayUsingJsonNotation( |
|
| 52 | $array, |
||
| 53 | $key = null, |
||
| 54 | $default = null |
||
| 55 | ) { |
||
| 56 | 2 | if (is_null($key)) { |
|
| 57 | 1 | return $array; |
|
| 58 | } |
||
| 59 | |||
| 60 | 2 | if (isset($array[ $key ])) { |
|
| 61 | 2 | return $array[ $key ]; |
|
| 62 | } |
||
| 63 | |||
| 64 | 2 | foreach (self::getArrayUsingJsonNotation($key) as $segment) { |
|
| 65 | 2 | if (!is_array($array) || !array_key_exists($segment, $array)) { |
|
| 66 | 1 | return $default; |
|
| 67 | } |
||
| 68 | 2 | $array = $array[ $segment ]; |
|
| 69 | 2 | } |
|
| 70 | |||
| 71 | 2 | return $array; |
|
| 72 | } |
||
| 73 | |||
| 94 |
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.