| Conditions | 12 | 
| Paths | 20 | 
| Total Lines | 35 | 
| Code Lines | 18 | 
| Lines | 9 | 
| Ratio | 25.71 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 101 |     protected function getWildcardValues($data, array $keys) { | 
            ||
| 102 | $values = [];  | 
            ||
| 103 | |||
| 104 | View Code Duplication |         if ( ! is_array($data) && ! $data instanceof Traversable) { | 
            |
| 105 |             if ($data instanceof IArrayable) { | 
            ||
| 106 | $data = $data->toArray();  | 
            ||
| 107 | }  | 
            ||
| 108 | |||
| 109 |             if ( ! is_array($data)) { | 
            ||
| 110 | $data = [];  | 
            ||
| 111 | }  | 
            ||
| 112 | }  | 
            ||
| 113 | |||
| 114 |         if (count($keys) === 0) { | 
            ||
| 115 |             foreach ($data as $itemKey => $itemValue) { | 
            ||
| 116 | $values[$itemKey] = $itemValue;  | 
            ||
| 117 | }  | 
            ||
| 118 | }  | 
            ||
| 119 | |||
| 120 |         if (count($keys) > 0) { | 
            ||
| 121 |             foreach ($data as $itemKey => $itemValue) { | 
            ||
| 122 | $nestedValues = $this->getValues($itemValue, $keys);  | 
            ||
| 123 | $isLastWildcard = ! array_contains($keys, ValidationToken::WILDCARD_VALUES);  | 
            ||
| 124 | |||
| 125 |                 foreach ($nestedValues as $nestedKey => $nestedValue) { | 
            ||
| 126 | // do no collect null values unless it is the last wildcard node  | 
            ||
| 127 |                     if ($nestedValue !== null || $isLastWildcard) { | 
            ||
| 128 | $values[$this->buildKey($itemKey, $nestedKey)] = $nestedValue;  | 
            ||
| 129 | }  | 
            ||
| 130 | }  | 
            ||
| 131 | }  | 
            ||
| 132 | }  | 
            ||
| 133 | |||
| 134 | return $values;  | 
            ||
| 135 | }  | 
            ||
| 136 | |||
| 188 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.