@@ -36,7 +36,9 @@ |
||
36 | 36 | */ |
37 | 37 | public function write(Geometry $geometry, $namespace = false) |
38 | 38 | { |
39 | - if ($geometry->isEmpty()) return null; |
|
39 | + if ($geometry->isEmpty()) { |
|
40 | + return null; |
|
41 | + } |
|
40 | 42 | if ($namespace) { |
41 | 43 | $this->namespace = $namespace; |
42 | 44 | $this->nss = $namespace.':'; |
@@ -102,7 +102,9 @@ |
||
102 | 102 | $line_length = unpack('L', fread($mem, 4)); |
103 | 103 | |
104 | 104 | // Return an empty linestring if there is no line-length |
105 | - if (!$line_length[1]) return new LineString(); |
|
105 | + if (!$line_length[1]) { |
|
106 | + return new LineString(); |
|
107 | + } |
|
106 | 108 | |
107 | 109 | // Read the nubmer of points x2 (each point is two coords) into decimal-floats |
108 | 110 | $line_coords = unpack('d*', fread($mem, $line_length[1]*$this->dimension*8)); |
@@ -31,7 +31,9 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function read($address, $return_type = 'point', $bounds = false, $return_multiple = false) |
33 | 33 | { |
34 | - if (is_array($address)) $address = join(',', $address); |
|
34 | + if (is_array($address)) { |
|
35 | + $address = join(',', $address); |
|
36 | + } |
|
35 | 37 | |
36 | 38 | if (gettype($bounds) == 'object') { |
37 | 39 | $bounds = $bounds->getBBox(); |
@@ -74,8 +76,11 @@ discard block |
||
74 | 76 | } |
75 | 77 | } |
76 | 78 | } else { |
77 | - if ($this->result->status) throw new Exception('Error in Google Geocoder: '.$this->result->status); |
|
78 | - else throw new Exception('Unknown error in Google Geocoder'); |
|
79 | + if ($this->result->status) { |
|
80 | + throw new Exception('Error in Google Geocoder: '.$this->result->status); |
|
81 | + } else { |
|
82 | + throw new Exception('Unknown error in Google Geocoder'); |
|
83 | + } |
|
79 | 84 | return false; |
80 | 85 | } |
81 | 86 | } |
@@ -114,8 +119,11 @@ discard block |
||
114 | 119 | return $this->result->results; |
115 | 120 | } |
116 | 121 | } else { |
117 | - if ($this->result->status) throw new Exception('Error in Google Reverse Geocoder: '.$this->result->status); |
|
118 | - else throw new Exception('Unknown error in Google Reverse Geocoder'); |
|
122 | + if ($this->result->status) { |
|
123 | + throw new Exception('Error in Google Reverse Geocoder: '.$this->result->status); |
|
124 | + } else { |
|
125 | + throw new Exception('Unknown error in Google Reverse Geocoder'); |
|
126 | + } |
|
119 | 127 | return false; |
120 | 128 | } |
121 | 129 | } |
@@ -243,7 +243,9 @@ |
||
243 | 243 | $str .= '<'.$this->nss.'coordinates>'; |
244 | 244 | $i=0; |
245 | 245 | foreach ($geom->getComponents() as $comp) { |
246 | - if ($i != 0) $str .= ' '; |
|
246 | + if ($i != 0) { |
|
247 | + $str .= ' '; |
|
248 | + } |
|
247 | 249 | $str .= $comp->getX() .','. $comp->getY(); |
248 | 250 | $i++; |
249 | 251 | } |
@@ -222,7 +222,9 @@ discard block |
||
222 | 222 | $output = '<'.$this->nss.'line>'; |
223 | 223 | foreach ($geom->getComponents() as $k => $point) { |
224 | 224 | $output .= $point->getY().' '.$point->getX(); |
225 | - if ($k < ($geom->numGeometries() -1)) $output .= ' '; |
|
225 | + if ($k < ($geom->numGeometries() -1)) { |
|
226 | + $output .= ' '; |
|
227 | + } |
|
226 | 228 | } |
227 | 229 | $output .= '</'.$this->nss.'line>'; |
228 | 230 | return $output; |
@@ -234,7 +236,9 @@ discard block |
||
234 | 236 | $exterior_ring = $geom->exteriorRing(); |
235 | 237 | foreach ($exterior_ring->getComponents() as $k => $point) { |
236 | 238 | $output .= $point->getY().' '.$point->getX(); |
237 | - if ($k < ($exterior_ring->numGeometries() -1)) $output .= ' '; |
|
239 | + if ($k < ($exterior_ring->numGeometries() -1)) { |
|
240 | + $output .= ' '; |
|
241 | + } |
|
238 | 242 | } |
239 | 243 | $output .= '</'.$this->nss.'polygon>'; |
240 | 244 | return $output; |
@@ -153,9 +153,11 @@ |
||
153 | 153 | 'type'=> 'GeometryCollection', |
154 | 154 | 'geometries'=> $component_array, |
155 | 155 | ); |
156 | - } else return array( |
|
156 | + } else { |
|
157 | + return array( |
|
157 | 158 | 'type'=> $geometry->getGeomType(), |
158 | 159 | 'coordinates'=> $geometry->asArray(), |
159 | 160 | ); |
161 | + } |
|
160 | 162 | } |
161 | 163 | } |
@@ -98,7 +98,9 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function write(Geometry $geometry, $precision = null) |
100 | 100 | { |
101 | - if ($geometry->isEmpty()) return ''; |
|
101 | + if ($geometry->isEmpty()) { |
|
102 | + return ''; |
|
103 | + } |
|
102 | 104 | |
103 | 105 | if ($geometry->geometryType() === 'Point') { |
104 | 106 | return $this->encodePoint($geometry, $precision); |
@@ -197,19 +199,59 @@ discard block |
||
197 | 199 | for ($i=0,$c=strlen($hash);$i<$c;$i++) { |
198 | 200 | $v = strpos($this->table, $hash[$i]); |
199 | 201 | if (1&$i) { |
200 | - if (16&$v)$minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
201 | - if (8&$v) $minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
202 | - if (4&$v) $minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
203 | - if (2&$v) $minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
204 | - if (1&$v) $minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
202 | + if (16&$v) { |
|
203 | + $minlat = ($minlat+$maxlat)/2; |
|
204 | + } else { |
|
205 | + $maxlat = ($minlat+$maxlat)/2; |
|
206 | + } |
|
207 | + if (8&$v) { |
|
208 | + $minlon = ($minlon+$maxlon)/2; |
|
209 | + } else { |
|
210 | + $maxlon = ($minlon+$maxlon)/2; |
|
211 | + } |
|
212 | + if (4&$v) { |
|
213 | + $minlat = ($minlat+$maxlat)/2; |
|
214 | + } else { |
|
215 | + $maxlat = ($minlat+$maxlat)/2; |
|
216 | + } |
|
217 | + if (2&$v) { |
|
218 | + $minlon = ($minlon+$maxlon)/2; |
|
219 | + } else { |
|
220 | + $maxlon = ($minlon+$maxlon)/2; |
|
221 | + } |
|
222 | + if (1&$v) { |
|
223 | + $minlat = ($minlat+$maxlat)/2; |
|
224 | + } else { |
|
225 | + $maxlat = ($minlat+$maxlat)/2; |
|
226 | + } |
|
205 | 227 | $latE /= 8; |
206 | 228 | $lonE /= 4; |
207 | 229 | } else { |
208 | - if (16&$v)$minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
209 | - if (8&$v) $minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
210 | - if (4&$v) $minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
211 | - if (2&$v) $minlat = ($minlat+$maxlat)/2; else $maxlat = ($minlat+$maxlat)/2; |
|
212 | - if (1&$v) $minlon = ($minlon+$maxlon)/2; else $maxlon = ($minlon+$maxlon)/2; |
|
230 | + if (16&$v) { |
|
231 | + $minlon = ($minlon+$maxlon)/2; |
|
232 | + } else { |
|
233 | + $maxlon = ($minlon+$maxlon)/2; |
|
234 | + } |
|
235 | + if (8&$v) { |
|
236 | + $minlat = ($minlat+$maxlat)/2; |
|
237 | + } else { |
|
238 | + $maxlat = ($minlat+$maxlat)/2; |
|
239 | + } |
|
240 | + if (4&$v) { |
|
241 | + $minlon = ($minlon+$maxlon)/2; |
|
242 | + } else { |
|
243 | + $maxlon = ($minlon+$maxlon)/2; |
|
244 | + } |
|
245 | + if (2&$v) { |
|
246 | + $minlat = ($minlat+$maxlat)/2; |
|
247 | + } else { |
|
248 | + $maxlat = ($minlat+$maxlat)/2; |
|
249 | + } |
|
250 | + if (1&$v) { |
|
251 | + $minlon = ($minlon+$maxlon)/2; |
|
252 | + } else { |
|
253 | + $maxlon = ($minlon+$maxlon)/2; |
|
254 | + } |
|
213 | 255 | $latE /= 4; |
214 | 256 | $lonE /= 8; |
215 | 257 | } |
@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | if (!$type) { |
55 | 55 | // If the user is trying to load a Geometry from a Geometry... Just pass it back |
56 | 56 | if (is_object($data)) { |
57 | - if ($data instanceOf Geometry) return $data; |
|
57 | + if ($data instanceOf Geometry) { |
|
58 | + return $data; |
|
59 | + } |
|
58 | 60 | } |
59 | 61 | |
60 | 62 | $detected = geoPHP::detectFormat($data); |
@@ -124,7 +126,9 @@ discard block |
||
124 | 126 | static function geosInstalled($force = null) |
125 | 127 | { |
126 | 128 | static $geos_installed = null; |
127 | - if ($force !== null) $geos_installed = $force; |
|
129 | + if ($force !== null) { |
|
130 | + $geos_installed = $force; |
|
131 | + } |
|
128 | 132 | if ($geos_installed !== null) { |
129 | 133 | return $geos_installed; |
130 | 134 | } |
@@ -154,8 +158,12 @@ discard block |
||
154 | 158 | { |
155 | 159 | // If it's an array of one, then just parse the one |
156 | 160 | if (is_array($geometry)) { |
157 | - if (empty($geometry)) return false; |
|
158 | - if (count($geometry) == 1) return geoPHP::geometryReduce(array_shift($geometry)); |
|
161 | + if (empty($geometry)) { |
|
162 | + return false; |
|
163 | + } |
|
164 | + if (count($geometry) == 1) { |
|
165 | + return geoPHP::geometryReduce(array_shift($geometry)); |
|
166 | + } |
|
159 | 167 | } |
160 | 168 | |
161 | 169 | // If the geometry cannot even theoretically be reduced more, then pass it back |
@@ -233,7 +241,9 @@ discard block |
||
233 | 241 | $bytes = unpack("c*", fread($mem, 11)); |
234 | 242 | |
235 | 243 | // If bytes is empty, then we were passed empty input |
236 | - if (empty($bytes)) return false; |
|
244 | + if (empty($bytes)) { |
|
245 | + return false; |
|
246 | + } |
|
237 | 247 | |
238 | 248 | // First char is a tab, space or carriage-return. trim it and try again |
239 | 249 | if ($bytes[1] == 9 || $bytes[1] == 10 || $bytes[1] == 32) { |
@@ -244,8 +254,11 @@ discard block |
||
244 | 254 | // Detect WKB or EWKB -- first byte is 1 (little endian indicator) |
245 | 255 | if ($bytes[1] == 1) { |
246 | 256 | // If SRID byte is TRUE (1), it's EWKB |
247 | - if ($bytes[5]) return 'ewkb'; |
|
248 | - else return 'wkb'; |
|
257 | + if ($bytes[5]) { |
|
258 | + return 'ewkb'; |
|
259 | + } else { |
|
260 | + return 'wkb'; |
|
261 | + } |
|
249 | 262 | } |
250 | 263 | |
251 | 264 | // Detect HEX encoded WKB or EWKB (PostGIS format) -- first byte is 48, second byte is 49 (hex '01' => first-byte = 1) |
@@ -278,12 +291,24 @@ discard block |
||
278 | 291 | if ($bytes[1] == 60) { |
279 | 292 | // grab the first 256 characters |
280 | 293 | $string = substr($input, 0, 256); |
281 | - if (strpos($string, '<kml') !== false) return 'kml'; |
|
282 | - if (strpos($string, '<coordinate') !== false) return 'kml'; |
|
283 | - if (strpos($string, '<gpx') !== false) return 'gpx'; |
|
284 | - if (strpos($string, '<georss') !== false) return 'georss'; |
|
285 | - if (strpos($string, '<rss') !== false) return 'georss'; |
|
286 | - if (strpos($string, '<feed') !== false) return 'georss'; |
|
294 | + if (strpos($string, '<kml') !== false) { |
|
295 | + return 'kml'; |
|
296 | + } |
|
297 | + if (strpos($string, '<coordinate') !== false) { |
|
298 | + return 'kml'; |
|
299 | + } |
|
300 | + if (strpos($string, '<gpx') !== false) { |
|
301 | + return 'gpx'; |
|
302 | + } |
|
303 | + if (strpos($string, '<georss') !== false) { |
|
304 | + return 'georss'; |
|
305 | + } |
|
306 | + if (strpos($string, '<rss') !== false) { |
|
307 | + return 'georss'; |
|
308 | + } |
|
309 | + if (strpos($string, '<feed') !== false) { |
|
310 | + return 'georss'; |
|
311 | + } |
|
287 | 312 | } |
288 | 313 | |
289 | 314 | // We need an 8 byte string for geohash and unpacked WKB / WKT |
@@ -465,13 +465,23 @@ |
||
465 | 465 | if ($this->product->multiprices_base_type[$key] != $oldproduct->multiprices_base_type[$key]) { |
466 | 466 | $pricemodified = true; |
467 | 467 | } else { |
468 | - if ($this->product->multiprices_tva_tx[$key] != $oldproduct->multiprices_tva_tx[$key]) $pricemodified = true; |
|
468 | + if ($this->product->multiprices_tva_tx[$key] != $oldproduct->multiprices_tva_tx[$key]) { |
|
469 | + $pricemodified = true; |
|
470 | + } |
|
469 | 471 | if ($this->product->multiprices_base_type[$key] == 'TTC') { |
470 | - if ($this->product->multiprices_ttc[$key] != $oldproduct->multiprices_ttc[$key]) $pricemodified = true; |
|
471 | - if ($this->product->multiprices_min_ttc[$key] != $oldproduct->multiprices_min_ttc[$key]) $pricemodified = true; |
|
472 | + if ($this->product->multiprices_ttc[$key] != $oldproduct->multiprices_ttc[$key]) { |
|
473 | + $pricemodified = true; |
|
474 | + } |
|
475 | + if ($this->product->multiprices_min_ttc[$key] != $oldproduct->multiprices_min_ttc[$key]) { |
|
476 | + $pricemodified = true; |
|
477 | + } |
|
472 | 478 | } else { |
473 | - if ($this->product->multiprices[$key] != $oldproduct->multiprices[$key]) $pricemodified = true; |
|
474 | - if ($this->product->multiprices_min[$key] != $oldproduct->multiprices[$key]) $pricemodified = true; |
|
479 | + if ($this->product->multiprices[$key] != $oldproduct->multiprices[$key]) { |
|
480 | + $pricemodified = true; |
|
481 | + } |
|
482 | + if ($this->product->multiprices_min[$key] != $oldproduct->multiprices[$key]) { |
|
483 | + $pricemodified = true; |
|
484 | + } |
|
475 | 485 | } |
476 | 486 | } |
477 | 487 | if ($pricemodified && $result > 0) { |