Completed
Branch develop (fa72bb)
by
unknown
26:08
created
htdocs/includes/geoPHP/lib/geometry/Geometry.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@
 block discarded – undo
60 60
 
61 61
 	public function envelope()
62 62
 	{
63
-		if ($this->isEmpty()) return new Polygon();
63
+		if ($this->isEmpty()) {
64
+			return new Polygon();
65
+		}
64 66
 
65 67
 		if ($this->geos()) {
66 68
 			return geoPHP::geosToGeometry($this->geos()->envelope());
Please login to merge, or discard this patch.
htdocs/includes/geoPHP/lib/geometry/Collection.class.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,14 +53,17 @@  discard block
 block discarded – undo
53 53
 	public function invertxy()
54 54
 	{
55 55
 		for ($i=0;$i<count($this->components);$i++) {
56
-			if ( method_exists($this->components[$i], 'invertxy') )
57
-			$this->components[$i]->invertxy();
56
+			if ( method_exists($this->components[$i], 'invertxy') ) {
57
+						$this->components[$i]->invertxy();
58
+			}
58 59
 		}
59 60
 	}
60 61
 
61 62
 	public function centroid()
62 63
 	{
63
-		if ($this->isEmpty()) return null;
64
+		if ($this->isEmpty()) {
65
+			return null;
66
+		}
64 67
 
65 68
 		if ($this->geos()) {
66 69
 			$geos_centroid = $this->geos()->centroid();
@@ -79,7 +82,9 @@  discard block
 block discarded – undo
79 82
 
80 83
 	public function getBBox()
81 84
 	{
82
-		if ($this->isEmpty()) return null;
85
+		if ($this->isEmpty()) {
86
+			return null;
87
+		}
83 88
 
84 89
 		if ($this->geos()) {
85 90
 			$envelope = $this->geos()->envelope();
@@ -150,7 +155,9 @@  discard block
 block discarded – undo
150 155
 	// By default, the boundary of a collection is the boundary of it's components
151 156
 	public function boundary()
152 157
 	{
153
-		if ($this->isEmpty()) return new LineString();
158
+		if ($this->isEmpty()) {
159
+			return new LineString();
160
+		}
154 161
 
155 162
 		if ($this->geos()) {
156 163
 			return $this->geos()->boundary();
@@ -224,7 +231,9 @@  discard block
 block discarded – undo
224 231
 			return true;
225 232
 		} else {
226 233
 			foreach ($this->components as $component) {
227
-				if (!$component->isEmpty()) return false;
234
+				if (!$component->isEmpty()) {
235
+					return false;
236
+				}
228 237
 			}
229 238
 			return true;
230 239
 		}
@@ -295,7 +304,9 @@  discard block
 block discarded – undo
295 304
 
296 305
 		// A collection is simple if all it's components are simple
297 306
 		foreach ($this->components as $component) {
298
-			if (!$component->isSimple()) return false;
307
+			if (!$component->isSimple()) {
308
+				return false;
309
+			}
299 310
 		}
300 311
 
301 312
 		return true;
Please login to merge, or discard this patch.
htdocs/includes/geoPHP/lib/geometry/Point.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,9 @@
 block discarded – undo
83 83
 	{
84 84
 		if ($this->dimension == 3) {
85 85
 			return $this->coords[2];
86
-		} else return null;
86
+		} else {
87
+			return null;
88
+		}
87 89
 	}
88 90
 
89 91
 	/**
Please login to merge, or discard this patch.
htdocs/includes/geoPHP/lib/geometry/LineString.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,9 @@
 block discarded – undo
62 62
 
63 63
 	public function dimension()
64 64
 	{
65
-		if ($this->isEmpty()) return 0;
65
+		if ($this->isEmpty()) {
66
+			return 0;
67
+		}
66 68
 		return 1;
67 69
 	}
68 70
 
Please login to merge, or discard this patch.
htdocs/includes/geoPHP/lib/geometry/Polygon.class.php 1 patch
Braces   +26 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 	public function area($exterior_only = false, $signed = false)
18 18
 	{
19
-		if ($this->isEmpty()) return 0;
19
+		if ($this->isEmpty()) {
20
+			return 0;
21
+		}
20 22
 
21 23
 		if ($this->geos() && $exterior_only == false) {
22 24
 			return $this->geos()->area();
@@ -26,15 +28,20 @@  discard block
 block discarded – undo
26 28
 		$pts = $exterior_ring->getComponents();
27 29
 
28 30
 		$c = count($pts);
29
-		if ((int) $c == '0') return null;
31
+		if ((int) $c == '0') {
32
+			return null;
33
+		}
30 34
 		$a = '0';
31 35
 		foreach ($pts as $k => $p) {
32 36
 			$j = ($k + 1) % $c;
33 37
 			$a = $a + ($p->getX() * $pts[$j]->getY()) - ($p->getY() * $pts[$j]->getX());
34 38
 		}
35 39
 
36
-		if ($signed) $area = ($a / 2);
37
-		else $area = abs(($a / 2));
40
+		if ($signed) {
41
+			$area = ($a / 2);
42
+		} else {
43
+			$area = abs(($a / 2));
44
+		}
38 45
 
39 46
 		if ($exterior_only == true) {
40 47
 			return $area;
@@ -50,7 +57,9 @@  discard block
 block discarded – undo
50 57
 
51 58
 	public function centroid()
52 59
 	{
53
-		if ($this->isEmpty()) return null;
60
+		if ($this->isEmpty()) {
61
+			return null;
62
+		}
54 63
 
55 64
 		if ($this->geos()) {
56 65
 			return geoPHP::geosToGeometry($this->geos()->centroid());
@@ -60,7 +69,9 @@  discard block
 block discarded – undo
60 69
 		$pts = $exterior_ring->getComponents();
61 70
 
62 71
 		$c = count($pts);
63
-		if ((int) $c == '0') return null;
72
+		if ((int) $c == '0') {
73
+			return null;
74
+		}
64 75
 		$cn = array('x' => '0', 'y' => '0');
65 76
 		$a = $this->area(true, true);
66 77
 
@@ -108,13 +119,17 @@  discard block
 block discarded – undo
108 119
 
109 120
 	public function exteriorRing()
110 121
 	{
111
-		if ($this->isEmpty()) return new LineString();
122
+		if ($this->isEmpty()) {
123
+			return new LineString();
124
+		}
112 125
 		return $this->components[0];
113 126
 	}
114 127
 
115 128
 	public function numInteriorRings()
116 129
 	{
117
-		if ($this->isEmpty()) return 0;
130
+		if ($this->isEmpty()) {
131
+			return 0;
132
+		}
118 133
 		return $this->numGeometries()-1;
119 134
 	}
120 135
 
@@ -125,7 +140,9 @@  discard block
 block discarded – undo
125 140
 
126 141
 	public function dimension()
127 142
 	{
128
-		if ($this->isEmpty()) return 0;
143
+		if ($this->isEmpty()) {
144
+			return 0;
145
+		}
129 146
 		return 2;
130 147
 	}
131 148
 
Please login to merge, or discard this patch.
htdocs/includes/geoPHP/lib/adapters/WKT.class.php 1 patch
Braces   +55 added lines, -19 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@  discard block
 block discarded – undo
63 63
 		$data_string = $this->trimParens($data_string);
64 64
 
65 65
 		// If it's marked as empty, then return an empty point
66
-		if ($data_string == 'EMPTY') return new Point();
66
+		if ($data_string == 'EMPTY') {
67
+			return new Point();
68
+		}
67 69
 
68 70
 		$parts = explode(' ', $data_string);
69 71
 		return new Point($parts[0], $parts[1]);
@@ -74,7 +76,9 @@  discard block
 block discarded – undo
74 76
 		$data_string = $this->trimParens($data_string);
75 77
 
76 78
 		// If it's marked as empty, then return an empty line
77
-		if ($data_string == 'EMPTY') return new LineString();
79
+		if ($data_string == 'EMPTY') {
80
+			return new LineString();
81
+		}
78 82
 
79 83
 		$parts = explode(',', $data_string);
80 84
 		$points = array();
@@ -89,13 +93,19 @@  discard block
 block discarded – undo
89 93
 		$data_string = $this->trimParens($data_string);
90 94
 
91 95
 		// If it's marked as empty, then return an empty polygon
92
-		if ($data_string == 'EMPTY') return new Polygon();
96
+		if ($data_string == 'EMPTY') {
97
+			return new Polygon();
98
+		}
93 99
 
94 100
 		$parts = explode('),(', $data_string);
95 101
 		$lines = array();
96 102
 		foreach ($parts as $part) {
97
-			if (!$this->beginsWith($part, '(')) $part = '(' . $part;
98
-			if (!$this->endsWith($part, ')'))   $part = $part . ')';
103
+			if (!$this->beginsWith($part, '(')) {
104
+				$part = '(' . $part;
105
+			}
106
+			if (!$this->endsWith($part, ')')) {
107
+				$part = $part . ')';
108
+			}
99 109
 			$lines[] = $this->parseLineString($part);
100 110
 		}
101 111
 		return new Polygon($lines);
@@ -106,7 +116,9 @@  discard block
 block discarded – undo
106 116
 		$data_string = $this->trimParens($data_string);
107 117
 
108 118
 		// If it's marked as empty, then return an empty MutiPoint
109
-		if ($data_string == 'EMPTY') return new MultiPoint();
119
+		if ($data_string == 'EMPTY') {
120
+			return new MultiPoint();
121
+		}
110 122
 
111 123
 		$parts = explode(',', $data_string);
112 124
 		$points = array();
@@ -121,14 +133,20 @@  discard block
 block discarded – undo
121 133
 		$data_string = $this->trimParens($data_string);
122 134
 
123 135
 		// If it's marked as empty, then return an empty multi-linestring
124
-		if ($data_string == 'EMPTY') return new MultiLineString();
136
+		if ($data_string == 'EMPTY') {
137
+			return new MultiLineString();
138
+		}
125 139
 
126 140
 		$parts = explode('),(', $data_string);
127 141
 		$lines = array();
128 142
 		foreach ($parts as $part) {
129 143
 			// Repair the string if the explode broke it
130
-			if (!$this->beginsWith($part, '(')) $part = '(' . $part;
131
-			if (!$this->endsWith($part, ')'))   $part = $part . ')';
144
+			if (!$this->beginsWith($part, '(')) {
145
+				$part = '(' . $part;
146
+			}
147
+			if (!$this->endsWith($part, ')')) {
148
+				$part = $part . ')';
149
+			}
132 150
 			$lines[] = $this->parseLineString($part);
133 151
 		}
134 152
 		return new MultiLineString($lines);
@@ -139,14 +157,20 @@  discard block
 block discarded – undo
139 157
 		$data_string = $this->trimParens($data_string);
140 158
 
141 159
 		// If it's marked as empty, then return an empty multi-polygon
142
-		if ($data_string == 'EMPTY') return new MultiPolygon();
160
+		if ($data_string == 'EMPTY') {
161
+			return new MultiPolygon();
162
+		}
143 163
 
144 164
 		$parts = explode(')),((', $data_string);
145 165
 		$polys = array();
146 166
 		foreach ($parts as $part) {
147 167
 			// Repair the string if the explode broke it
148
-			if (!$this->beginsWith($part, '((')) $part = '((' . $part;
149
-			if (!$this->endsWith($part, '))'))   $part = $part . '))';
168
+			if (!$this->beginsWith($part, '((')) {
169
+				$part = '((' . $part;
170
+			}
171
+			if (!$this->endsWith($part, '))')) {
172
+				$part = $part . '))';
173
+			}
150 174
 			$polys[] = $this->parsePolygon($part);
151 175
 		}
152 176
 		return new MultiPolygon($polys);
@@ -157,7 +181,9 @@  discard block
 block discarded – undo
157 181
 		$data_string = $this->trimParens($data_string);
158 182
 
159 183
 		// If it's marked as empty, then return an empty geom-collection
160
-		if ($data_string == 'EMPTY') return new GeometryCollection();
184
+		if ($data_string == 'EMPTY') {
185
+			return new GeometryCollection();
186
+		}
161 187
 
162 188
 		$geometries = array();
163 189
 		$matches = array();
@@ -178,7 +204,9 @@  discard block
 block discarded – undo
178 204
 			return substr($wkt, $first_paren);
179 205
 		} elseif (strstr($wkt, 'EMPTY')) {
180 206
 			return 'EMPTY';
181
-		} else return false;
207
+		} else {
208
+			return false;
209
+		}
182 210
 	}
183 211
 
184 212
 	/**
@@ -191,19 +219,27 @@  discard block
 block discarded – undo
191 219
 		// We want to only strip off one set of parenthesis
192 220
 		if ($this->beginsWith($str, '(')) {
193 221
 			return substr($str, 1, -1);
194
-		} else return $str;
222
+		} else {
223
+			return $str;
224
+		}
195 225
 	}
196 226
 
197 227
 	protected function beginsWith($str, $char)
198 228
 	{
199
-		if (substr($str, 0, strlen($char)) == $char) return true;
200
-		else return false;
229
+		if (substr($str, 0, strlen($char)) == $char) {
230
+			return true;
231
+		} else {
232
+			return false;
233
+		}
201 234
 	}
202 235
 
203 236
 	protected function endsWith($str, $char)
204 237
 	{
205
-		if (substr($str, (0 - strlen($char))) == $char) return true;
206
-		else return false;
238
+		if (substr($str, (0 - strlen($char))) == $char) {
239
+			return true;
240
+		} else {
241
+			return false;
242
+		}
207 243
 	}
208 244
 
209 245
 	/**
Please login to merge, or discard this patch.
htdocs/includes/geoPHP/lib/adapters/GPX.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
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.':';
Please login to merge, or discard this patch.
htdocs/includes/geoPHP/lib/adapters/WKB.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,9 @@
 block discarded – undo
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));
Please login to merge, or discard this patch.
htdocs/includes/geoPHP/lib/adapters/GoogleGeocode.class.php 1 patch
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.