| Conditions | 11 |
| Paths | 32 |
| Total Lines | 47 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 121 | public function send() |
||
| 122 | { |
||
| 123 | // Default options |
||
| 124 | $this->setCurlOption(CURLOPT_RETURNTRANSFER, true); |
||
| 125 | $this->setCurlOption(CURLINFO_HEADER_OUT, true); |
||
| 126 | |||
| 127 | // Additional headers |
||
| 128 | if (isset($this->options['headers']) && count($this->options['headers']) > 0) { |
||
| 129 | $this->options['request_headers'] = array_merge($this->options['request_headers'], $this->options['headers']); |
||
| 130 | } |
||
| 131 | |||
| 132 | // SSL |
||
| 133 | if (isset($this->options['ssl'])) { |
||
| 134 | $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, true); |
||
| 135 | $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 2); |
||
| 136 | $this->setCurlOption(CURLOPT_CAINFO, getcwd() . $this->options['ssl']); |
||
| 137 | } |
||
| 138 | |||
| 139 | // Payload |
||
| 140 | if (isset($this->options['is_payload']) && $this->options['is_payload'] === true) { |
||
| 141 | // Appropriate headers for sending a JSON object |
||
| 142 | $this->options['request_headers'] = array_merge($this->options['request_headers'], [ |
||
| 143 | 'Content-Type: application/json', |
||
| 144 | 'Content-Length: ' . ((isset($this->options['data'])) ? strlen(json_encode($this->options['data'])) : 0) |
||
| 145 | ]); |
||
| 146 | } |
||
| 147 | |||
| 148 | // Set headers |
||
| 149 | if (count($this->options['request_headers']) > 0) { |
||
| 150 | $this->setCurlOption(CURLOPT_HTTPHEADER, $this->options['request_headers']); |
||
| 151 | } |
||
| 152 | |||
| 153 | // Retrieving HTTP response body |
||
| 154 | $this->response = curl_exec($this->ch); |
||
| 155 | |||
| 156 | // Retrieving HTTP status code |
||
| 157 | $this->status = $this->getCurlInfo(CURLINFO_HTTP_CODE); |
||
| 158 | |||
| 159 | // Retrieving HTTP header |
||
| 160 | $this->header = $this->getCurlInfo(CURLINFO_HEADER_OUT); |
||
| 161 | |||
| 162 | // Autoclose handle |
||
| 163 | if (!isset($this->options['autoclose']) || (isset($this->options['autoclose']) && $this->options['autoclose'] !== false)) { |
||
| 164 | $this->close(); |
||
| 165 | } |
||
| 166 | |||
| 167 | return $this; |
||
| 168 | } |
||
| 178 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths