@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | foreach ($components as $component) { |
25 | 25 | if ($component instanceof Geometry) { |
26 | 26 | $this->components[] = $component; |
27 | - } |
|
28 | - else { |
|
27 | + } else { |
|
29 | 28 | throw new Exception("Cannot create a collection with non-geometries"); |
30 | 29 | } |
31 | 30 | } |
@@ -41,7 +40,9 @@ discard block |
||
41 | 40 | } |
42 | 41 | |
43 | 42 | public function centroid() { |
44 | - if ($this->isEmpty()) return NULL; |
|
43 | + if ($this->isEmpty()) { |
|
44 | + return NULL; |
|
45 | + } |
|
45 | 46 | |
46 | 47 | if ($this->geos()) { |
47 | 48 | $geos_centroid = $this->geos()->centroid(); |
@@ -59,7 +60,9 @@ discard block |
||
59 | 60 | } |
60 | 61 | |
61 | 62 | public function getBBox() { |
62 | - if ($this->isEmpty()) return NULL; |
|
63 | + if ($this->isEmpty()) { |
|
64 | + return NULL; |
|
65 | + } |
|
63 | 66 | |
64 | 67 | if ($this->geos()) { |
65 | 68 | $envelope = $this->geos()->envelope(); |
@@ -127,7 +130,9 @@ discard block |
||
127 | 130 | |
128 | 131 | // By default, the boundary of a collection is the boundary of it's components |
129 | 132 | public function boundary() { |
130 | - if ($this->isEmpty()) return new LineString(); |
|
133 | + if ($this->isEmpty()) { |
|
134 | + return new LineString(); |
|
135 | + } |
|
131 | 136 | |
132 | 137 | if ($this->geos()) { |
133 | 138 | return $this->geos()->boundary(); |
@@ -149,8 +154,7 @@ discard block |
||
149 | 154 | $n = intval($n); |
150 | 155 | if (array_key_exists($n-1, $this->components)) { |
151 | 156 | return $this->components[$n-1]; |
152 | - } |
|
153 | - else { |
|
157 | + } else { |
|
154 | 158 | return NULL; |
155 | 159 | } |
156 | 160 | } |
@@ -193,10 +197,11 @@ discard block |
||
193 | 197 | public function isEmpty() { |
194 | 198 | if (!count($this->components)) { |
195 | 199 | return TRUE; |
196 | - } |
|
197 | - else { |
|
200 | + } else { |
|
198 | 201 | foreach ($this->components as $component) { |
199 | - if (!$component->isEmpty()) return FALSE; |
|
202 | + if (!$component->isEmpty()) { |
|
203 | + return FALSE; |
|
204 | + } |
|
200 | 205 | } |
201 | 206 | return TRUE; |
202 | 207 | } |
@@ -263,7 +268,9 @@ discard block |
||
263 | 268 | |
264 | 269 | // A collection is simple if all it's components are simple |
265 | 270 | foreach ($this->components as $component) { |
266 | - if (!$component->isSimple()) return FALSE; |
|
271 | + if (!$component->isSimple()) { |
|
272 | + return FALSE; |
|
273 | + } |
|
267 | 274 | } |
268 | 275 | |
269 | 276 | return TRUE; |
@@ -54,7 +54,9 @@ |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | public function dimension() { |
57 | - if ($this->isEmpty()) return 0; |
|
57 | + if ($this->isEmpty()) { |
|
58 | + return 0; |
|
59 | + } |
|
58 | 60 | return 1; |
59 | 61 | } |
60 | 62 |
@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | public function envelope() { |
60 | - if ($this->isEmpty()) return new Polygon(); |
|
60 | + if ($this->isEmpty()) { |
|
61 | + return new Polygon(); |
|
62 | + } |
|
61 | 63 | |
62 | 64 | if ($this->geos()) { |
63 | 65 | return geoPHP::geosToGeometry($this->geos()->envelope()); |
@@ -148,8 +150,7 @@ discard block |
||
148 | 150 | if (geoPHP::geosInstalled()) { |
149 | 151 | $reader = new GEOSWKBReader(); |
150 | 152 | $this->geos = $reader->readHEX($this->out('wkb',TRUE)); |
151 | - } |
|
152 | - else { |
|
153 | + } else { |
|
153 | 154 | $this->geos = FALSE; |
154 | 155 | } |
155 | 156 | return $this->geos; |
@@ -175,8 +176,7 @@ discard block |
||
175 | 176 | if ($this->geos()) { |
176 | 177 | if ($pattern) { |
177 | 178 | return $this->geos()->relate($geometry->geos(), $pattern); |
178 | - } |
|
179 | - else { |
|
179 | + } else { |
|
180 | 180 | return $this->geos()->relate($geometry->geos()); |
181 | 181 | } |
182 | 182 | } |
@@ -227,8 +227,7 @@ discard block |
||
227 | 227 | $geom = $geom->union($item->geos()); |
228 | 228 | } |
229 | 229 | return geoPHP::geosToGeometry($geom); |
230 | - } |
|
231 | - else { |
|
230 | + } else { |
|
232 | 231 | return geoPHP::geosToGeometry($this->geos()->union($geometry->geos())); |
233 | 232 | } |
234 | 233 | } |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | if (!$type) { |
53 | 53 | // If the user is trying to load a Geometry from a Geometry... Just pass it back |
54 | 54 | if (is_object($data)) { |
55 | - if ($data instanceOf Geometry) return $data; |
|
55 | + if ($data instanceOf Geometry) { |
|
56 | + return $data; |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | |
58 | 60 | $detected = geoPHP::detectFormat($data); |
@@ -120,7 +122,9 @@ discard block |
||
120 | 122 | |
121 | 123 | static function geosInstalled($force = NULL) { |
122 | 124 | static $geos_installed = NULL; |
123 | - if ($force !== NULL) $geos_installed = $force; |
|
125 | + if ($force !== NULL) { |
|
126 | + $geos_installed = $force; |
|
127 | + } |
|
124 | 128 | if ($geos_installed !== NULL) { |
125 | 129 | return $geos_installed; |
126 | 130 | } |
@@ -148,8 +152,12 @@ discard block |
||
148 | 152 | static function geometryReduce($geometry) { |
149 | 153 | // If it's an array of one, then just parse the one |
150 | 154 | if (is_array($geometry)) { |
151 | - if (empty($geometry)) return FALSE; |
|
152 | - if (count($geometry) == 1) return geoPHP::geometryReduce(array_shift($geometry)); |
|
155 | + if (empty($geometry)) { |
|
156 | + return FALSE; |
|
157 | + } |
|
158 | + if (count($geometry) == 1) { |
|
159 | + return geoPHP::geometryReduce(array_shift($geometry)); |
|
160 | + } |
|
153 | 161 | } |
154 | 162 | |
155 | 163 | // If the geometry cannot even theoretically be reduced more, then pass it back |
@@ -168,8 +176,7 @@ discard block |
||
168 | 176 | $components = $geometry->getComponents(); |
169 | 177 | if (count($components) == 1) { |
170 | 178 | return $components[0]; |
171 | - } |
|
172 | - else { |
|
179 | + } else { |
|
173 | 180 | return $geometry; |
174 | 181 | } |
175 | 182 | } |
@@ -192,8 +199,7 @@ discard block |
||
192 | 199 | $geometries[] = $component; |
193 | 200 | $geom_types[] = $component->geometryType(); |
194 | 201 | } |
195 | - } |
|
196 | - else { |
|
202 | + } else { |
|
197 | 203 | $geometries[] = $item; |
198 | 204 | $geom_types[] = $item->geometryType(); |
199 | 205 | } |
@@ -209,13 +215,11 @@ discard block |
||
209 | 215 | if (count($geom_types) == 1) { |
210 | 216 | if (count($geometries) == 1) { |
211 | 217 | return $geometries[0]; |
212 | - } |
|
213 | - else { |
|
218 | + } else { |
|
214 | 219 | $class = 'Multi'.$geom_types[0]; |
215 | 220 | return new $class($geometries); |
216 | 221 | } |
217 | - } |
|
218 | - else { |
|
222 | + } else { |
|
219 | 223 | return new GeometryCollection($geometries); |
220 | 224 | } |
221 | 225 | } |
@@ -230,7 +234,9 @@ discard block |
||
230 | 234 | $bytes = unpack("c*", fread($mem, 11)); |
231 | 235 | |
232 | 236 | // If bytes is empty, then we were passed empty input |
233 | - if (empty($bytes)) return FALSE; |
|
237 | + if (empty($bytes)) { |
|
238 | + return FALSE; |
|
239 | + } |
|
234 | 240 | |
235 | 241 | // First char is a tab, space or carriage-return. trim it and try again |
236 | 242 | if ($bytes[1] == 9 || $bytes[1] == 10 || $bytes[1] == 32) { |
@@ -240,8 +246,11 @@ discard block |
||
240 | 246 | // Detect WKB or EWKB -- first byte is 1 (little endian indicator) |
241 | 247 | if ($bytes[1] == 1) { |
242 | 248 | // If SRID byte is TRUE (1), it's EWKB |
243 | - if ($bytes[5]) return 'ewkb'; |
|
244 | - else return 'wkb'; |
|
249 | + if ($bytes[5]) { |
|
250 | + return 'ewkb'; |
|
251 | + } else { |
|
252 | + return 'wkb'; |
|
253 | + } |
|
245 | 254 | } |
246 | 255 | |
247 | 256 | // Detect HEX encoded WKB or EWKB (PostGIS format) -- first byte is 48, second byte is 49 (hex '01' => first-byte = 1) |
@@ -274,12 +283,24 @@ discard block |
||
274 | 283 | if ($bytes[1] == 60) { |
275 | 284 | // grab the first 256 characters |
276 | 285 | $string = substr($input, 0, 256); |
277 | - if (strpos($string, '<kml') !== FALSE) return 'kml'; |
|
278 | - if (strpos($string, '<coordinate') !== FALSE) return 'kml'; |
|
279 | - if (strpos($string, '<gpx') !== FALSE) return 'gpx'; |
|
280 | - if (strpos($string, '<georss') !== FALSE) return 'georss'; |
|
281 | - if (strpos($string, '<rss') !== FALSE) return 'georss'; |
|
282 | - if (strpos($string, '<feed') !== FALSE) return 'georss'; |
|
286 | + if (strpos($string, '<kml') !== FALSE) { |
|
287 | + return 'kml'; |
|
288 | + } |
|
289 | + if (strpos($string, '<coordinate') !== FALSE) { |
|
290 | + return 'kml'; |
|
291 | + } |
|
292 | + if (strpos($string, '<gpx') !== FALSE) { |
|
293 | + return 'gpx'; |
|
294 | + } |
|
295 | + if (strpos($string, '<georss') !== FALSE) { |
|
296 | + return 'georss'; |
|
297 | + } |
|
298 | + if (strpos($string, '<rss') !== FALSE) { |
|
299 | + return 'georss'; |
|
300 | + } |
|
301 | + if (strpos($string, '<feed') !== FALSE) { |
|
302 | + return 'georss'; |
|
303 | + } |
|
283 | 304 | } |
284 | 305 | |
285 | 306 | // We need an 8 byte string for geohash and unpacked WKB / WKT |
@@ -8,7 +8,9 @@ |
||
8 | 8 | $registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | -} else $spotter_array = array(); |
|
11 | +} else { |
|
12 | + $spotter_array = array(); |
|
13 | +} |
|
12 | 14 | |
13 | 15 | if (!empty($spotter_array)) |
14 | 16 | { |
@@ -8,8 +8,11 @@ |
||
8 | 8 | $date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
9 | 9 | |
10 | 10 | $Spotter = new Spotter(); |
11 | -if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
12 | -else $spotter_array = array(); |
|
11 | +if (isset($_GET['date'])) { |
|
12 | + $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
13 | +} else { |
|
14 | + $spotter_array = array(); |
|
15 | +} |
|
13 | 16 | |
14 | 17 | if (!empty($spotter_array)) |
15 | 18 | { |
@@ -5,8 +5,11 @@ |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | $registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
7 | 7 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
8 | -if (isset($_GET['sort'])) $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
|
9 | -else $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1"); |
|
8 | +if (isset($_GET['sort'])) { |
|
9 | + $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
|
10 | +} else { |
|
11 | + $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1"); |
|
12 | +} |
|
10 | 13 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | 14 | |
12 | 15 |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | print '<fieldset class="form-group">'; |
24 | 24 | print '<label for="metar_message">'._("METAR Message").'</label>'; |
25 | 25 | print '<textarea class="form-control" name="metar_message" id="metar_message" rows="5">'; |
26 | -if ($message != '') print $message; |
|
26 | +if ($message != '') { |
|
27 | + print $message; |
|
28 | +} |
|
27 | 29 | print '</textarea>'; |
28 | 30 | print '</fieldset>'; |
29 | 31 | print '<button type="submit" class="btn btn-primary">Submit</button>'; |
@@ -59,7 +61,9 @@ discard block |
||
59 | 61 | if (isset($metar_parse['cloud'])) { |
60 | 62 | print '<b>'._("Cloud:").'</b> '; |
61 | 63 | foreach ($metar_parse['cloud'] as $key => $cloud) { |
62 | - if ($key > 0) print ' / '; |
|
64 | + if ($key > 0) { |
|
65 | + print ' / '; |
|
66 | + } |
|
63 | 67 | print $cloud['type'].' at '.$cloud['level'].' m'; |
64 | 68 | } |
65 | 69 | print " "; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $limit_start = 0; |
19 | 19 | $limit_end = 25; |
20 | 20 | $absolute_difference = 25; |
21 | -} else { |
|
21 | +} else { |
|
22 | 22 | $limit_explode = explode(",", $_GET['limit']); |
23 | 23 | $limit_start = $limit_explode[0]; |
24 | 24 | $limit_end = $limit_explode[1]; |