Conditions | 1 |
Paths | 1 |
Total Lines | 69 |
Code Lines | 62 |
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 |
||
106 | public function leafletJsTileLayers(): array |
||
107 | { |
||
108 | $api_key = $this->getPreference('api_key'); |
||
109 | |||
110 | return [ |
||
111 | (object) [ |
||
112 | 'accessToken' => $api_key, |
||
113 | 'attribution' => '©<a href="https://www.mapbox.com/about/maps">Mapbox</a> ©<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback">Improve this map</a></strong>', |
||
114 | 'default' => false, |
||
115 | 'id' => 'dark-v10', |
||
116 | 'label' => 'Dark', |
||
117 | 'maxZoom' => 20, |
||
118 | 'minZoom' => 2, |
||
119 | 'subdomains' => ['a', 'b', 'c', 'd'], |
||
120 | 'tileSize' => 512, |
||
121 | 'url' => 'https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', |
||
122 | 'zoomOffset' => -1, |
||
123 | ], |
||
124 | (object) [ |
||
125 | 'accessToken' => $api_key, |
||
126 | 'attribution' => '©<a href="https://www.mapbox.com/about/maps">Mapbox</a> ©<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback">Improve this map</a></strong>', |
||
127 | 'default' => true, |
||
128 | 'id' => 'light-v10', |
||
129 | 'label' => 'Light', |
||
130 | 'maxZoom' => 20, |
||
131 | 'minZoom' => 2, |
||
132 | 'subdomains' => ['a', 'b', 'c', 'd'], |
||
133 | 'tileSize' => 512, |
||
134 | 'url' => 'https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', |
||
135 | 'zoomOffset' => -1, |
||
136 | ], |
||
137 | (object) [ |
||
138 | 'accessToken' => $api_key, |
||
139 | 'attribution' => '©<a href="https://www.mapbox.com/about/maps">Mapbox</a> ©<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback">Improve this map</a></strong>', |
||
140 | 'default' => false, |
||
141 | 'id' => 'outdoors-v11', |
||
142 | 'label' => 'Outdoors', |
||
143 | 'maxZoom' => 20, |
||
144 | 'minZoom' => 2, |
||
145 | 'subdomains' => ['a', 'b', 'c', 'd'], |
||
146 | 'tileSize' => 512, |
||
147 | 'url' => 'https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', |
||
148 | 'zoomOffset' => -1, |
||
149 | ], |
||
150 | (object) [ |
||
151 | 'accessToken' => $api_key, |
||
152 | 'attribution' => '©<a href="https://www.mapbox.com/about/maps">Mapbox</a> ©<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback">Improve this map</a></strong>', |
||
153 | 'default' => false, |
||
154 | 'id' => 'satellite-v9', |
||
155 | 'label' => 'Satellite', |
||
156 | 'maxZoom' => 20, |
||
157 | 'minZoom' => 2, |
||
158 | 'subdomains' => ['a', 'b', 'c', 'd'], |
||
159 | 'tileSize' => 512, |
||
160 | 'url' => 'https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', |
||
161 | 'zoomOffset' => -1, |
||
162 | ], |
||
163 | (object) [ |
||
164 | 'accessToken' => $api_key, |
||
165 | 'attribution' => '©<a href="https://www.mapbox.com/about/maps">Mapbox</a> ©<a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback">Improve this map</a></strong>', |
||
166 | 'default' => false, |
||
167 | 'id' => 'streets-v11', |
||
168 | 'label' => 'Streets', |
||
169 | 'maxZoom' => 20, |
||
170 | 'minZoom' => 2, |
||
171 | 'subdomains' => ['a', 'b', 'c', 'd'], |
||
172 | 'tileSize' => 512, |
||
173 | 'url' => 'https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', |
||
174 | 'zoomOffset' => -1, |
||
175 | ], |
||
179 |