| Conditions | 7 |
| Paths | 25 |
| Total Lines | 52 |
| 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 |
||
| 64 | public function prepareMiddleware($enable = true) |
||
| 65 | { |
||
| 66 | App::instance('middleware.disable', ! $enable); |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Call the given URI and return the Response. |
||
| 71 | * |
||
| 72 | * @param string $method |
||
| 73 | * @param string $uri |
||
| 74 | * @param array $parameters |
||
| 75 | * @param array $cookies |
||
| 76 | * @param array $files |
||
| 77 | * @param array $server |
||
| 78 | * @param string $content |
||
| 79 | * |
||
| 80 | * @return \Illuminate\Http\Response |
||
| 81 | */ |
||
| 82 | public function callRoute($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) |
||
| 83 | { |
||
| 84 | $server = collect([ |
||
| 85 | 'CONTENT_TYPE' => 'application/json', |
||
| 86 | 'Accept' => 'application/json', |
||
| 87 | ])->merge($server)->toArray(); |
||
| 88 | |||
| 89 | $request = Request::create( |
||
| 90 | $uri, $method, $parameters, |
||
| 91 | $cookies, $files, $this->transformHeadersToServerVars($server), $content |
||
| 92 | ); |
||
| 93 | |||
| 94 | $kernel = App::make('Illuminate\Contracts\Http\Kernel'); |
||
| 95 | $response = $kernel->handle($request); |
||
| 96 | |||
| 97 | $kernel->terminate($request, $response); |
||
| 98 | |||
| 99 | return $response; |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Get a response from the transformer tags. |
||
| 104 | * |
||
| 105 | * @param array $tags |
||
| 106 | * |
||
| 107 | * @return mixed |
||
| 108 | */ |
||
| 109 | protected function getTransformerResponse($tags) |
||
| 110 | { |
||
| 111 | try { |
||
| 112 | $transFormerTags = array_filter($tags, function ($tag) { |
||
| 113 | if (! ($tag instanceof Tag)) { |
||
| 114 | return false; |
||
| 115 | } |
||
| 116 | |||
| 195 |
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.