| Conditions | 11 |
| Paths | 10 |
| Total Lines | 71 |
| Code Lines | 41 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 147 | public function printFields($object) |
||
| 148 | { |
||
| 149 | ++$this->count; |
||
| 150 | $links = []; |
||
| 151 | foreach ($this->fieldsToTest as $field) { |
||
| 152 | if (! empty($object->{$field})) { |
||
| 153 | $dom = new \DOMDocument(); |
||
| 154 | |||
| 155 | @$dom->loadHTML( |
||
| 156 | mb_convert_encoding($object->{$field}, 'HTML-ENTITIES', 'UTF-8'), |
||
| 157 | LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD |
||
| 158 | ); |
||
| 159 | // if (! $dom) { |
||
| 160 | // $links[] = 'Error 1 in ' . $field; |
||
| 161 | // |
||
| 162 | // continue; |
||
| 163 | // } |
||
| 164 | if (! $this->type || 'a' === strtolower($this->type)) { |
||
| 165 | $hrefs = $dom->getElementsByTagName('a'); |
||
| 166 | for ($i = 0; $i < $hrefs->length; ++$i) { |
||
| 167 | $href = $hrefs->item($i); |
||
| 168 | $url = $href->getAttribute('href'); |
||
| 169 | $this->cleanupLittleMistake($object, $field, $url); |
||
| 170 | |||
| 171 | $links[$url] = $url . ' | A | ' . $field; |
||
| 172 | |||
| 173 | if (! isset($this->allLinks[$url])) { |
||
| 174 | $this->allLinks[$url] = [ |
||
| 175 | 'count' => 0, |
||
| 176 | 'type' => 'A', |
||
| 177 | ]; |
||
| 178 | } |
||
| 179 | ++$this->allLinks[$url]['count']; |
||
| 180 | } |
||
| 181 | } |
||
| 182 | if (! $this->type || 'img' === strtolower($this->type)) { |
||
| 183 | $hrefs = $dom->getElementsByTagName('img'); |
||
| 184 | for ($i = 0; $i < $hrefs->length; ++$i) { |
||
| 185 | $href = $hrefs->item($i); |
||
| 186 | $url = $href->getAttribute('src'); |
||
| 187 | $this->cleanupLittleMistake($object, $field, $url); |
||
| 188 | |||
| 189 | $links[$url] = $url . ' | IMG | ' . $field; |
||
| 190 | |||
| 191 | if (! isset($this->allLinks[$url])) { |
||
| 192 | $this->allLinks[$url] = [ |
||
| 193 | 'count' => 0, |
||
| 194 | 'type' => 'IMG', |
||
| 195 | ]; |
||
| 196 | } |
||
| 197 | ++$this->allLinks[$url]['count']; |
||
| 198 | } |
||
| 199 | } else { |
||
| 200 | $links[] = 'Error 2 in ' . $field; |
||
| 201 | } |
||
| 202 | } |
||
| 203 | } |
||
| 204 | echo |
||
| 205 | '<tr> |
||
| 206 | <td>' . $this->count . '</td> |
||
| 207 | <td> |
||
| 208 | <h6><a href="' . $object->CMSEditLink() . '">CMS</></h6> |
||
| 209 | <h6><a href="' . $object->Link() . '">Site</a></h6> |
||
| 210 | </td> |
||
| 211 | <td> |
||
| 212 | ' . $object->Title . ' |
||
| 213 | </td> |
||
| 214 | <td> |
||
| 215 | <ul> |
||
| 216 | <li> |
||
| 217 | ' . implode('</li><li>', $links) . ' |
||
| 218 | </li> |
||
| 265 |
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