| Conditions | 11 | 
| Paths | 144 | 
| Total Lines | 64 | 
| Code Lines | 41 | 
| 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  | 
            ||
| 130 | protected function call($http_method, $route, array $params = array(), array $headers = array())  | 
            ||
| 131 |     { | 
            ||
| 132 | $url = $this->api_base_url . '/';  | 
            ||
| 133 |         if (!empty($this->version)) { | 
            ||
| 134 | $url .= $this->version . '/';  | 
            ||
| 135 | }  | 
            ||
| 136 | |||
| 137 | $url .= $route;  | 
            ||
| 138 | |||
| 139 | $this->request  | 
            ||
| 140 | ->init()  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 141 | ->setOption(CURLOPT_CUSTOMREQUEST, strtoupper($http_method))  | 
            ||
| 142 | ->setOption(CURLOPT_RETURNTRANSFER, true)  | 
            ||
| 143 | ->setOption(CURLOPT_FOLLOWLOCATION, true)  | 
            ||
| 144 | ->setOption(CURLOPT_ENCODING, '');  | 
            ||
| 145 | |||
| 146 |         foreach ($this->curl_options as $option => $value) { | 
            ||
| 147 | $this->request->setOption($option, $value);  | 
            ||
| 148 | }  | 
            ||
| 149 | |||
| 150 | $headers = array_merge($this->headers, $headers);  | 
            ||
| 151 | $headers['Authorization'] = "Bearer " . $this->oAuthProvider->getAccessToken();  | 
            ||
| 152 | $headers['x-kobas-company-id'] = $this->oAuthProvider->getCompanyId();  | 
            ||
| 153 | $headers['Content-Type'] = 'application/json';  | 
            ||
| 154 | |||
| 155 |         switch ($http_method) { | 
            ||
| 156 | case 'POST':  | 
            ||
| 157 | $this->request->setOption(CURLOPT_POSTFIELDS, json_encode($params));  | 
            ||
| 158 | break;  | 
            ||
| 159 | case 'DELETE':  | 
            ||
| 160 | case 'PUT':  | 
            ||
| 161 | $this->request->setOption(CURLOPT_POSTFIELDS, json_encode($params));  | 
            ||
| 162 | break;  | 
            ||
| 163 | case 'GET':  | 
            ||
| 164 |                 if (count($params)) { | 
            ||
| 165 | $url .= "?" . http_build_query($params);  | 
            ||
| 166 | }  | 
            ||
| 167 | break;  | 
            ||
| 168 | }  | 
            ||
| 169 | |||
| 170 | $this->request->setUrl($url);  | 
            ||
| 171 | |||
| 172 | $requestHeaders = array();  | 
            ||
| 173 |         foreach ($headers as $key => $value) { | 
            ||
| 174 | $requestHeaders[] = $key . ': ' . $value;  | 
            ||
| 175 | }  | 
            ||
| 176 | |||
| 177 | $this->request->setOption(CURLOPT_HTTPHEADER, $requestHeaders);  | 
            ||
| 178 | |||
| 179 | $result = $this->request->execute();  | 
            ||
| 180 | |||
| 181 |         if ($this->request->getErrorNumber()) { | 
            ||
| 182 | throw new CurlException($this->request->getErrorMessage(), $this->request->getErrorNumber());  | 
            ||
| 183 | }  | 
            ||
| 184 | |||
| 185 | $last_response = $this->request->getInfo(CURLINFO_HTTP_CODE);  | 
            ||
| 186 | |||
| 187 | $this->request->close();  | 
            ||
| 188 | |||
| 189 |         if ($last_response >= 400) { | 
            ||
| 190 | throw new HttpException(json_encode(json_decode($result, true), true), $last_response);  | 
            ||
| 191 | }  | 
            ||
| 192 | |||
| 193 | return json_decode($result, true);  | 
            ||
| 194 | }  | 
            ||
| 235 | 
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.