| Conditions | 12 | 
| Paths | 1 | 
| Total Lines | 71 | 
| Lines | 34 | 
| Ratio | 47.89 % | 
| Tests | 38 | 
| CRAP Score | 12.0024 | 
| 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 | ||
| 18 | 208 | public function transformEnums(): Closure | |
| 19 |     { | ||
| 20 |         return function (array $transformations) { | ||
| 21 | 72 |             if (isset($transformations[EnumRequest::REQUEST_ROUTE])) { | |
| 22 | 8 | $route = $this->route(); | |
|  | |||
| 23 | |||
| 24 | 8 |                 foreach ($transformations[EnumRequest::REQUEST_ROUTE] as $key => $enumClass) { | |
| 25 | 8 |                     if (! $route->hasParameter($key)) { | |
| 26 | 4 | continue; | |
| 27 | } | ||
| 28 | |||
| 29 | 4 | $route->setParameter( | |
| 30 | 4 | $key, | |
| 31 | 4 | forward_static_call( | |
| 32 | 4 | $enumClass.'::make', | |
| 33 | 4 | $route->parameter($key) | |
| 34 | ) | ||
| 35 | ); | ||
| 36 | } | ||
| 37 | |||
| 38 | 8 | unset($transformations[EnumRequest::REQUEST_ROUTE]); | |
| 39 | } | ||
| 40 | |||
| 41 | 72 | View Code Duplication |             if (isset($transformations[EnumRequest::REQUEST_QUERY])) { | 
| 42 | 24 |                 foreach ($transformations[EnumRequest::REQUEST_QUERY] as $key => $enumClass) { | |
| 43 | 24 |                     if (! $this->query->has($key)) { | |
| 44 | 8 | continue; | |
| 45 | } | ||
| 46 | |||
| 47 | 16 | $this->query->set( | |
| 48 | 16 | $key, | |
| 49 | 16 | forward_static_call( | |
| 50 | 16 | $enumClass.'::make', | |
| 51 | 16 | $this->query->get($key) | |
| 52 | ) | ||
| 53 | ); | ||
| 54 | } | ||
| 55 | |||
| 56 | 24 | unset($transformations[EnumRequest::REQUEST_QUERY]); | |
| 57 | } | ||
| 58 | |||
| 59 | 72 | View Code Duplication |             if (isset($transformations[EnumRequest::REQUEST_REQUEST])) { | 
| 60 | 28 |                 foreach ($transformations[EnumRequest::REQUEST_REQUEST] as $key => $enumClass) { | |
| 61 | 28 |                     if (! $this->request->has($key)) { | |
| 62 | 12 | continue; | |
| 63 | } | ||
| 64 | |||
| 65 | 16 | $this->request->set( | |
| 66 | 16 | $key, | |
| 67 | 16 | forward_static_call( | |
| 68 | 16 | $enumClass.'::make', | |
| 69 | 16 | $this->request->get($key) | |
| 70 | ) | ||
| 71 | ); | ||
| 72 | } | ||
| 73 | |||
| 74 | 28 | unset($transformations[EnumRequest::REQUEST_REQUEST]); | |
| 75 | } | ||
| 76 | |||
| 77 | 72 |             foreach ($transformations as $key => $enumClass) { | |
| 78 | 12 |                 if (! isset($this[$key])) { | |
| 79 | continue; | ||
| 80 | } | ||
| 81 | |||
| 82 | 12 | $this[$key] = forward_static_call( | |
| 83 | 12 | $enumClass.'::make', | |
| 84 | 12 | $this[$key] | |
| 85 | ); | ||
| 86 | } | ||
| 87 | 208 | }; | |
| 88 | } | ||
| 89 | } | ||
| 90 | 
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.