| Conditions | 6 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 6.0163 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 41 | 23 | public function get($key = null, $default = null) |
|
| 42 | { |
||
| 43 | 23 | $array = $this->data; |
|
| 44 | |||
| 45 | 23 | if ($key === null) { |
|
| 46 | 1 | return $array; |
|
| 47 | } |
||
| 48 | |||
| 49 | 22 | if (array_key_exists($key, $array)) { |
|
| 50 | 9 | return $array[$key]; |
|
| 51 | } |
||
| 52 | |||
| 53 | 22 | foreach (explode('.', $key) as $segment) { |
|
| 54 | 22 | if (is_array($array) && array_key_exists($segment, $array)) { |
|
| 55 | 22 | $array = $array[$segment]; |
|
| 56 | 22 | } else { |
|
| 57 | return $default; |
||
| 58 | } |
||
| 59 | 22 | } |
|
| 60 | |||
| 61 | 22 | return $array; |
|
| 62 | } |
||
| 63 | |||
| 66 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.