| Conditions | 10 | 
| Paths | 16 | 
| Total Lines | 31 | 
| Code Lines | 20 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 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  | 
            ||
| 39 | public function resolveParameterByNameOrPosition(ReflectionParameter $parameter, bool $variadic): array  | 
            ||
| 40 |     { | 
            ||
| 41 | $key = $this->modeNamed  | 
            ||
| 42 | ? $parameter->getName()  | 
            ||
| 43 | : $parameter->getPosition();  | 
            ||
| 44 | |||
| 45 |         if (!\array_key_exists($key, $this->arguments)) { | 
            ||
| 46 | return [];  | 
            ||
| 47 | }  | 
            ||
| 48 | $_val = &$this->arguments[$key];  | 
            ||
| 49 | |||
| 50 |         if ($variadic && \is_array($_val)) { | 
            ||
| 51 | // Save keys is possible  | 
            ||
| 52 | $positional = true;  | 
            ||
| 53 | $result = [];  | 
            ||
| 54 |             foreach ($_val as $key => &$item) { | 
            ||
| 55 |                 if (!$positional && \is_int($key)) { | 
            ||
| 56 | throw new ResolvingException(  | 
            ||
| 57 | 'Cannot use positional argument after named argument during unpacking named variadic argument.'  | 
            ||
| 58 | );  | 
            ||
| 59 | }  | 
            ||
| 60 | $positional = $positional && \is_int($key);  | 
            ||
| 61 |                 if ($positional) { | 
            ||
| 62 | $result[] = &$item;  | 
            ||
| 63 |                 } else { | 
            ||
| 64 | $result[$key] = &$item;  | 
            ||
| 65 | }  | 
            ||
| 66 | }  | 
            ||
| 67 | return $result;  | 
            ||
| 68 | }  | 
            ||
| 69 | return [&$_val];  | 
            ||
| 70 | }  | 
            ||
| 98 |