| Conditions | 22 |
| Paths | 128 |
| Total Lines | 68 |
| Code Lines | 43 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 122 | * Renders the sitemap |
||
| 123 | */ |
||
| 124 | private function renderSitemap() |
||
| 125 | { |
||
| 126 | $this->append('<?xml version="1.0" encoding="UTF-8"?>'); |
||
| 127 | $this->append('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"', 0, false); |
||
| 128 | if ($this->params['hasImages']) { |
||
| 129 | $this->append(' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"', 0, false); |
||
| 130 | } |
||
| 131 | if ($this->params['hasNews']) { |
||
| 132 | $this->append(' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"', 0, false); |
||
| 133 | } |
||
| 134 | $this->append('>', 0); |
||
| 135 | |||
| 136 | foreach ($this->params['tags'] as $tag) { |
||
| 137 | $this->renderUrl($tag); |
||
| 138 | } |
||
| 139 | |||
| 140 | $this->append('</urlset>', 0, false); |
||
| 141 | } |
||
| 142 | |||
| 143 | /** |
||
| 144 | * Renders a Url tag |
||
| 145 | * |
||
| 146 | * @param Url $tag |
||
| 147 | */ |
||
| 148 | private function renderUrl(Url $tag) |
||
| 149 | { |
||
| 150 | $this->append('<url>', 1); |
||
| 151 | if (! empty($tag->url)) { |
||
| 152 | $this->append('<loc>' . $this->format(url($tag->url)) . '</loc>', 2); |
||
| 153 | } |
||
| 154 | if (count($tag->alternates)) { |
||
| 155 | foreach ($tag->alternates as $alternate) { |
||
| 156 | $this->append('<xhtml:link rel="alternate" hreflang="' . $this->format($alternate->locale) . '" href="' . $this->format(url($alternate->url)) . '" />', 2); |
||
| 157 | } |
||
| 158 | } |
||
| 159 | if (! empty($tag->lastModificationDate)) { |
||
| 160 | $this->append('<lastmod>' . $tag->lastModificationDate->format(DateTime::ATOM) . '</lastmod>', 2); |
||
| 161 | } |
||
| 162 | if (! empty($tag->changeFrequency)) { |
||
| 163 | $this->append('<changefreq>' . $this->format($tag->changeFrequency) . '</changefreq>', 2); |
||
| 164 | } |
||
| 165 | if (! empty($tag->priority)) { |
||
| 166 | $this->append('<priority>' . number_format($tag->priority, 1) . '</priority>', 2); |
||
| 167 | } |
||
| 168 | if (count($tag->images)) { |
||
| 169 | foreach ($tag->images as $image) { |
||
| 170 | if (! empty($image->url)) { |
||
| 171 | $this->append('<image:image>', 2); |
||
| 172 | $this->append('<image:loc>' . url($image->url) . '</image:loc>', 3); |
||
| 173 | if (! empty($image->caption)) { |
||
| 174 | $this->append('<image:caption>' . $this->format($image->caption) . '</image:caption>', 3); |
||
| 175 | } |
||
| 176 | if (! empty($image->geo_location)) { |
||
| 177 | $this->append('<image:geo_location>' . $this->format($image->geo_location) . '</image:geo_location>', 3); |
||
| 178 | } |
||
| 179 | if (! empty($image->title)) { |
||
| 180 | $this->append('<image:title>' . $this->format($image->title) . '</image:title>', 3); |
||
| 181 | } |
||
| 182 | if (! empty($image->license)) { |
||
| 183 | $this->append('<image:license>' . $this->format($image->license) . '</image:license>', 3); |
||
| 184 | } |
||
| 185 | $this->append('</image:image>', 2); |
||
| 186 | } |
||
| 187 | } |
||
| 188 | } |
||
| 189 | if (count($tag->news)) { |
||
| 190 | foreach ($tag->news as $new) { |
||
| 292 |
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