| Conditions | 3 |
| Paths | 3 |
| Total Lines | 62 |
| Code Lines | 51 |
| 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 |
||
| 105 | public function leafletJsTileLayers(): array |
||
| 106 | { |
||
| 107 | $api_key = $this->getPreference('api_key'); |
||
| 108 | |||
| 109 | if ($api_key === '') { |
||
| 110 | $message = I18N::translate('This service requires an API key.'); |
||
| 111 | |||
| 112 | if (Auth::isAdmin()) { |
||
| 113 | $message = '<a href="' . e($this->getConfigLink()) . '">' . $message . '</a>'; |
||
| 114 | } |
||
| 115 | |||
| 116 | throw new HttpServerErrorException($message); |
||
| 117 | } |
||
| 118 | |||
| 119 | return [ |
||
| 120 | (object) [ |
||
| 121 | 'GM_API_KEY' => $api_key, |
||
| 122 | 'attribution' => 'Map data ©2021 Google LLC <a href="https://www.google.com/intl/en-GB_US/help/terms_maps">Terms of use</a>', |
||
| 123 | 'default' => true, |
||
| 124 | 'lyrs' => 'm', |
||
| 125 | 'maxZoom' => 20, |
||
| 126 | 'minZoom' => 2, |
||
| 127 | 'subdomains' => ['mt0', 'mt1', 'mt2', 'mt3'], |
||
| 128 | 'label' => 'Streets', |
||
| 129 | 'url' => 'https://{s}.google.com/vt/lyrs={lyrs}&x={x}&y={y}&z={z}', |
||
| 130 | 'localName' => 'GoogleStreets', |
||
| 131 | ], |
||
| 132 | (object) [ |
||
| 133 | 'GM_API_KEY' => $api_key, |
||
| 134 | 'attribution' => 'Map data ©2021 Google LLC <a href="https://www.google.com/intl/en-GB_US/help/terms_maps">Terms of use</a>', |
||
| 135 | 'default' => false, |
||
| 136 | 'lyrs' => 'y', |
||
| 137 | 'maxZoom' => 20, |
||
| 138 | 'minZoom' => 2, |
||
| 139 | 'subdomains' => ['mt0', 'mt1', 'mt2', 'mt3'], |
||
| 140 | 'label' => 'Hybrid', |
||
| 141 | 'url' => 'https://{s}.google.com/vt/lyrs={lyrs}&x={x}&y={y}&z={z}', |
||
| 142 | 'localName' => 'GoogleHybrid', |
||
| 143 | ], |
||
| 144 | (object) [ |
||
| 145 | 'GM_API_KEY' => $api_key, |
||
| 146 | 'attribution' => 'Map data ©2021 Google LLC <a href="https://www.google.com/intl/en-GB_US/help/terms_maps">Terms of use</a>', |
||
| 147 | 'default' => false, |
||
| 148 | 'lyrs' => 's', |
||
| 149 | 'maxZoom' => 20, |
||
| 150 | 'minZoom' => 2, |
||
| 151 | 'subdomains' => ['mt0', 'mt1', 'mt2', 'mt3'], |
||
| 152 | 'label' => 'Satellite', |
||
| 153 | 'url' => 'https://{s}.google.com/vt/lyrs={lyrs}&x={x}&y={y}&z={z}', |
||
| 154 | 'localName' => 'GoogleSatellite', |
||
| 155 | ], |
||
| 156 | (object) [ |
||
| 157 | 'GM_API_KEY' => $api_key, |
||
| 158 | 'attribution' => 'Map data ©2021 Google LLC <a href="https://www.google.com/intl/en-GB_US/help/terms_maps">Terms of use</a>', |
||
| 159 | 'default' => false, |
||
| 160 | 'lyrs' => 'p', |
||
| 161 | 'maxZoom' => 20, |
||
| 162 | 'minZoom' => 2, |
||
| 163 | 'subdomains' => ['mt0', 'mt1', 'mt2', 'mt3'], |
||
| 164 | 'label' => 'Terrain', |
||
| 165 | 'url' => 'https://{s}.google.com/vt/lyrs={lyrs}&x={x}&y={y}&z={z}', |
||
| 166 | 'localName' => 'GoogleTerrain', |
||
| 167 | ], |
||
| 171 |
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