@@ -91,7 +91,7 @@ discard block  | 
                                                    ||
| 91 | 91 | accessforbidden();  | 
                                                        
| 92 | 92 | }  | 
                                                        
| 93 | 93 | |
| 94 | -$permissiontoadd = $user->hasRight('ticket', 'write');	// Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles | 
                                                        |
| 94 | +$permissiontoadd = $user->hasRight('ticket', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles | 
                                                        |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | /*  | 
                                                        
@@ -211,7 +211,7 @@ discard block  | 
                                                    ||
| 211 | 211 |  	if ($resql) { | 
                                                        
| 212 | 212 | $file_msg_array = array();  | 
                                                        
| 213 | 213 | $numrows = $db->num_rows($resql);  | 
                                                        
| 214 | -		for ($i=0; $i < $numrows; $i++) { | 
                                                        |
| 214 | +		for ($i = 0; $i < $numrows; $i++) { | 
                                                        |
| 215 | 215 | $upload_msg_dir = $conf->agenda->dir_output.'/'.$db->fetch_row($resql)[0];  | 
                                                        
| 216 | 216 | $file_msg = dol_dir_list($upload_msg_dir, "files", 0, '', '\.meta$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);  | 
                                                        
| 217 | 217 |  			if (count($file_msg)) { | 
                                                        
@@ -52,9 +52,11 @@ discard block  | 
                                                    ||
| 52 | 52 | */  | 
                                                        
| 53 | 53 | public static function addPath($path)  | 
                                                        
| 54 | 54 |  		{ | 
                                                        
| 55 | - if (false === $path = stream_resolve_include_path($path))  | 
                                                        |
| 56 | - return false;  | 
                                                        |
| 57 | - else set_include_path($path.PATH_SEPARATOR.get_include_path());  | 
                                                        |
| 55 | +			if (false === $path = stream_resolve_include_path($path)) { | 
                                                        |
| 56 | + return false;  | 
                                                        |
| 57 | +			} else { | 
                                                        |
| 58 | + set_include_path($path.PATH_SEPARATOR.get_include_path());  | 
                                                        |
| 59 | + }  | 
                                                        |
| 58 | 60 | return $path;  | 
                                                        
| 59 | 61 | }  | 
                                                        
| 60 | 62 | |
@@ -67,16 +69,19 @@ discard block  | 
                                                    ||
| 67 | 69 | */  | 
                                                        
| 68 | 70 | public static function thereCanBeOnlyOne()  | 
                                                        
| 69 | 71 |  		{ | 
                                                        
| 70 | - if (static::$perfectLoaders === spl_autoload_functions())  | 
                                                        |
| 71 | - return static::$instance;  | 
                                                        |
| 72 | +			if (static::$perfectLoaders === spl_autoload_functions()) { | 
                                                        |
| 73 | + return static::$instance;  | 
                                                        |
| 74 | + }  | 
                                                        |
| 72 | 75 | |
| 73 | - if (false !== $loaders = spl_autoload_functions())  | 
                                                        |
| 74 | - if (0 < $count = count($loaders))  | 
                                                        |
| 76 | +			if (false !== $loaders = spl_autoload_functions()) { | 
                                                        |
| 77 | + if (0 < $count = count($loaders))  | 
                                                        |
| 75 | 78 | for ($i = 0, static::$rogueLoaders += $loaders;  | 
                                                        
| 79 | + }  | 
                                                        |
| 76 | 80 | $i < $count && false != ($loader = $loaders[$i]);  | 
                                                        
| 77 | - $i++)  | 
                                                        |
| 78 | - if ($loader !== static::$perfectLoaders[0])  | 
                                                        |
| 81 | +					 $i++) { | 
                                                        |
| 82 | + if ($loader !== static::$perfectLoaders[0])  | 
                                                        |
| 79 | 83 | spl_autoload_unregister($loader);  | 
                                                        
| 84 | + }  | 
                                                        |
| 80 | 85 | |
| 81 | 86 | return static::$instance;  | 
                                                        
| 82 | 87 | }  | 
                                                        
@@ -105,12 +110,14 @@ discard block  | 
                                                    ||
| 105 | 110 | return false;  | 
                                                        
| 106 | 111 | }  | 
                                                        
| 107 | 112 | |
| 108 | - if (empty(static::$classMap[$key]))  | 
                                                        |
| 109 | - static::$classMap[$key] = $value;  | 
                                                        |
| 113 | +			if (empty(static::$classMap[$key])) { | 
                                                        |
| 114 | + static::$classMap[$key] = $value;  | 
                                                        |
| 115 | + }  | 
                                                        |
| 110 | 116 | |
| 111 | - if (is_string($alias = static::$classMap[$key]))  | 
                                                        |
| 112 | - if (isset(static::$classMap[$alias]))  | 
                                                        |
| 117 | +			if (is_string($alias = static::$classMap[$key])) { | 
                                                        |
| 118 | + if (isset(static::$classMap[$alias]))  | 
                                                        |
| 113 | 119 | return static::$classMap[$alias];  | 
                                                        
| 120 | + }  | 
                                                        |
| 114 | 121 | |
| 115 | 122 | return static::$classMap[$key];  | 
                                                        
| 116 | 123 | }  | 
                                                        
@@ -138,8 +145,8 @@ discard block  | 
                                                    ||
| 138 | 145 | array($dir, 'vendor', 'composer'),  | 
                                                        
| 139 | 146 | array($dir, '..', '..', '..', 'php'),  | 
                                                        
| 140 | 147 | array($dir, 'vendor', 'php'))  | 
                                                        
| 141 | - as $includePath)  | 
                                                        |
| 142 | - if (false !== $path = stream_resolve_include_path(  | 
                                                        |
| 148 | +				as $includePath) { | 
                                                        |
| 149 | + if (false !== $path = stream_resolve_include_path(  | 
                                                        |
| 143 | 150 | implode($slash, $includePath)  | 
                                                        
| 144 | 151 | ))  | 
                                                        
| 145 | 152 |  				if ('composer' == end($includePath) && | 
                                                        
@@ -150,18 +157,22 @@ discard block  | 
                                                    ||
| 150 | 157 | static::seen(static::loadFile(  | 
                                                        
| 151 | 158 | $classmapPath  | 
                                                        
| 152 | 159 | ));  | 
                                                        
| 160 | + }  | 
                                                        |
| 153 | 161 | $paths = array_merge(  | 
                                                        
| 154 | 162 | $paths,  | 
                                                        
| 155 | 163 | array_values(static::loadFile(  | 
                                                        
| 156 | 164 |  							"$path{$slash}autoload_namespaces.php" | 
                                                        
| 157 | 165 | ))  | 
                                                        
| 158 | 166 | );  | 
                                                        
| 159 | - } else $paths[] = $path;  | 
                                                        |
| 167 | +				} else { | 
                                                        |
| 168 | + $paths[] = $path;  | 
                                                        |
| 169 | + }  | 
                                                        |
| 160 | 170 | |
| 161 | 171 | $paths = array_filter(array_map(  | 
                                                        
| 162 | 172 |  				function ($path) { | 
                                                        
| 163 | - if (false == $realPath = @realpath($path))  | 
                                                        |
| 164 | - return null;  | 
                                                        |
| 173 | +					if (false == $realPath = @realpath($path)) { | 
                                                        |
| 174 | + return null;  | 
                                                        |
| 175 | + }  | 
                                                        |
| 165 | 176 | return $realPath . DIRECTORY_SEPARATOR;  | 
                                                        
| 166 | 177 | },  | 
                                                        
| 167 | 178 | $paths  | 
                                                        
@@ -200,9 +211,11 @@ discard block  | 
                                                    ||
| 200 | 211 | private function loadPrefixes($className)  | 
                                                        
| 201 | 212 |  		{ | 
                                                        
| 202 | 213 | $currentClass = $className;  | 
                                                        
| 203 | - if (false !== $pos = strrpos($className, '\\'))  | 
                                                        |
| 204 | - $className = substr($className, $pos);  | 
                                                        |
| 205 | - else $className = "\\$className";  | 
                                                        |
| 214 | +			if (false !== $pos = strrpos($className, '\\')) { | 
                                                        |
| 215 | + $className = substr($className, $pos);  | 
                                                        |
| 216 | +			} else { | 
                                                        |
| 217 | + $className = "\\$className";  | 
                                                        |
| 218 | + }  | 
                                                        |
| 206 | 219 | |
| 207 | 220 | for (  | 
                                                        
| 208 | 221 | $i = 0,  | 
                                                        
@@ -231,12 +244,13 @@ discard block  | 
                                                    ||
| 231 | 244 | private function loadAliases($className)  | 
                                                        
| 232 | 245 |  		{ | 
                                                        
| 233 | 246 | $file = false;  | 
                                                        
| 234 | -			if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) | 
                                                        |
| 235 | - for (  | 
                                                        |
| 247 | +			if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) { | 
                                                        |
| 248 | + for (  | 
                                                        |
| 236 | 249 | $i = 0,  | 
                                                        
| 237 | 250 | $aliases = isset(static::$aliases[$parts[1]])  | 
                                                        
| 238 | 251 | ? static::$aliases[$parts[1]] : array(),  | 
                                                        
| 239 | 252 | $count = count($aliases);  | 
                                                        
| 253 | + }  | 
                                                        |
| 240 | 254 | $i < $count && false === $file;  | 
                                                        
| 241 | 255 | $file = $this->discover(  | 
                                                        
| 242 | 256 |  					"{$aliases[$i++]}$parts[2]", | 
                                                        
@@ -263,13 +277,15 @@ discard block  | 
                                                    ||
| 263 | 277 |  		{ | 
                                                        
| 264 | 278 | $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR);  | 
                                                        
| 265 | 279 |  			if (isset($loader)) { | 
                                                        
| 266 | - if (false === array_search($loader, $loaders))  | 
                                                        |
| 267 | - static::$rogueLoaders[] = $loader;  | 
                                                        |
| 280 | +				if (false === array_search($loader, $loaders)) { | 
                                                        |
| 281 | + static::$rogueLoaders[] = $loader;  | 
                                                        |
| 282 | + }  | 
                                                        |
| 268 | 283 | return $this->loadThisLoader($className, $loader);  | 
                                                        
| 269 | 284 | }  | 
                                                        
| 270 | - foreach ($loaders as $loader)  | 
                                                        |
| 271 | - if (false !== $file = $this->loadThisLoader($className, $loader))  | 
                                                        |
| 285 | +			foreach ($loaders as $loader) { | 
                                                        |
| 286 | + if (false !== $file = $this->loadThisLoader($className, $loader))  | 
                                                        |
| 272 | 287 | return $file;  | 
                                                        
| 288 | + }  | 
                                                        |
| 273 | 289 | |
| 274 | 290 | return false;  | 
                                                        
| 275 | 291 | }  | 
                                                        
@@ -342,13 +358,18 @@ discard block  | 
                                                    ||
| 342 | 358 | */  | 
                                                        
| 343 | 359 | private function alias($className, $currentClass)  | 
                                                        
| 344 | 360 |  		{ | 
                                                        
| 345 | - if ($className == 'Luracast\Restler\string') return;  | 
                                                        |
| 346 | - if ($className == 'Luracast\Restler\mixed') return;  | 
                                                        |
| 361 | +			if ($className == 'Luracast\Restler\string') { | 
                                                        |
| 362 | + return;  | 
                                                        |
| 363 | + }  | 
                                                        |
| 364 | +			if ($className == 'Luracast\Restler\mixed') { | 
                                                        |
| 365 | + return;  | 
                                                        |
| 366 | + }  | 
                                                        |
| 347 | 367 | if ($className != $currentClass  | 
                                                        
| 348 | - && false !== strpos($className, $currentClass))  | 
                                                        |
| 349 | - if (!class_exists($currentClass, false)  | 
                                                        |
| 368 | +			&& false !== strpos($className, $currentClass)) { | 
                                                        |
| 369 | + if (!class_exists($currentClass, false)  | 
                                                        |
| 350 | 370 | && class_alias($className, $currentClass))  | 
                                                        
| 351 | 371 | static::seen($currentClass, $className);  | 
                                                        
| 372 | + }  | 
                                                        |
| 352 | 373 | }  | 
                                                        
| 353 | 374 | |
| 354 | 375 | /**  | 
                                                        
@@ -366,11 +387,12 @@ discard block  | 
                                                    ||
| 366 | 387 | |
| 367 | 388 | /** The short version we've done this before and found it in cache */  | 
                                                        
| 368 | 389 |  			if (false !== $file = static::seen($className)) { | 
                                                        
| 369 | - if (!$this->exists($className))  | 
                                                        |
| 370 | - if (is_callable($file))  | 
                                                        |
| 390 | +				if (!$this->exists($className)) { | 
                                                        |
| 391 | + if (is_callable($file))  | 
                                                        |
| 371 | 392 | $file = $this->loadLastResort($className, $file);  | 
                                                        
| 372 | - elseif ($file = stream_resolve_include_path($file))  | 
                                                        |
| 373 | - $file = static::loadFile($file);  | 
                                                        |
| 393 | +				} elseif ($file = stream_resolve_include_path($file)) { | 
                                                        |
| 394 | + $file = static::loadFile($file);  | 
                                                        |
| 395 | + }  | 
                                                        |
| 374 | 396 | |
| 375 | 397 | $this->alias($className, $currentClass);  | 
                                                        
| 376 | 398 | return $file;  | 
                                                        
@@ -380,15 +402,17 @@ discard block  | 
                                                    ||
| 380 | 402 | |
| 381 | 403 | /** replace \ with / and _ in CLASS NAME with / = PSR-0 in 3 lines */  | 
                                                        
| 382 | 404 |  			$file = preg_replace("/\\\|_(?=\w+$)/", DIRECTORY_SEPARATOR, $className); | 
                                                        
| 383 | -			if (false === $file = stream_resolve_include_path("$file.php")) | 
                                                        |
| 384 | - return false;  | 
                                                        |
| 405 | +			if (false === $file = stream_resolve_include_path("$file.php")) { | 
                                                        |
| 406 | + return false;  | 
                                                        |
| 407 | + }  | 
                                                        |
| 385 | 408 | |
| 386 | 409 | /** have we loaded this file before could this be an alias */  | 
                                                        
| 387 | 410 |  			if (in_array($file, get_included_files())) { | 
                                                        
| 388 | - if (false !== $sameFile = array_search($file, static::$classMap))  | 
                                                        |
| 389 | - if (!$this->exists($className, $file))  | 
                                                        |
| 411 | +				if (false !== $sameFile = array_search($file, static::$classMap)) { | 
                                                        |
| 412 | + if (!$this->exists($className, $file))  | 
                                                        |
| 390 | 413 | if (false !== strpos($sameFile, $className))  | 
                                                        
| 391 | 414 | $this->alias($sameFile, $className);  | 
                                                        
| 415 | + }  | 
                                                        |
| 392 | 416 | |
| 393 | 417 | return $file;  | 
                                                        
| 394 | 418 | }  | 
                                                        
@@ -396,17 +420,19 @@ discard block  | 
                                                    ||
| 396 | 420 | $state = array_merge(get_declared_classes(), get_declared_interfaces());  | 
                                                        
| 397 | 421 | |
| 398 | 422 |  			if (false !== $result = static::loadFile($file)) { | 
                                                        
| 399 | - if ($this->exists($className, $file))  | 
                                                        |
| 400 | - $this->alias($className, $currentClass);  | 
                                                        |
| 401 | - elseif (false != $diff = array_diff(  | 
                                                        |
| 402 | - array_merge(get_declared_classes(), get_declared_interfaces()), $state))  | 
                                                        |
| 403 | - foreach ($diff as $autoLoaded)  | 
                                                        |
| 423 | +				if ($this->exists($className, $file)) { | 
                                                        |
| 424 | + $this->alias($className, $currentClass);  | 
                                                        |
| 425 | + } elseif (false != $diff = array_diff(  | 
                                                        |
| 426 | +				array_merge(get_declared_classes(), get_declared_interfaces()), $state)) { | 
                                                        |
| 427 | + foreach ($diff as $autoLoaded)  | 
                                                        |
| 404 | 428 | if ($this->exists($autoLoaded, $file))  | 
                                                        
| 405 | 429 | if (false !== strpos($autoLoaded, $className))  | 
                                                        
| 406 | 430 | $this->alias($autoLoaded, $className);  | 
                                                        
| 431 | + }  | 
                                                        |
| 407 | 432 | |
| 408 | - if (!$this->exists($currentClass))  | 
                                                        |
| 409 | - $result = false;  | 
                                                        |
| 433 | +				if (!$this->exists($currentClass)) { | 
                                                        |
| 434 | + $result = false;  | 
                                                        |
| 435 | + }  | 
                                                        |
| 410 | 436 | }  | 
                                                        
| 411 | 437 | |
| 412 | 438 | return $result;  | 
                                                        
@@ -424,10 +450,12 @@ discard block  | 
                                                    ||
| 424 | 450 | private function exists($className, $mapping = null)  | 
                                                        
| 425 | 451 |  		{ | 
                                                        
| 426 | 452 | if (class_exists($className, false)  | 
                                                        
| 427 | - || interface_exists($className, false))  | 
                                                        |
| 428 | - if (isset($mapping))  | 
                                                        |
| 453 | +			|| interface_exists($className, false)) { | 
                                                        |
| 454 | + if (isset($mapping))  | 
                                                        |
| 429 | 455 | return static::seen($className, $mapping);  | 
                                                        
| 430 | - else return true;  | 
                                                        |
| 456 | +			} else { | 
                                                        |
| 457 | + return true;  | 
                                                        |
| 458 | + }  | 
                                                        |
| 431 | 459 | return false;  | 
                                                        
| 432 | 460 | }  | 
                                                        
| 433 | 461 | |
@@ -440,22 +468,27 @@ discard block  | 
                                                    ||
| 440 | 468 | */  | 
                                                        
| 441 | 469 | public function __invoke($className)  | 
                                                        
| 442 | 470 |  		{ | 
                                                        
| 443 | - if (empty($className))  | 
                                                        |
| 444 | - return false;  | 
                                                        |
| 471 | +			if (empty($className)) { | 
                                                        |
| 472 | + return false;  | 
                                                        |
| 473 | + }  | 
                                                        |
| 445 | 474 | |
| 446 | - if (false !== $includeReference = $this->discover($className))  | 
                                                        |
| 447 | - return $includeReference;  | 
                                                        |
| 475 | +			if (false !== $includeReference = $this->discover($className)) { | 
                                                        |
| 476 | + return $includeReference;  | 
                                                        |
| 477 | + }  | 
                                                        |
| 448 | 478 | |
| 449 | 479 | //static::thereCanBeOnlyOne();  | 
                                                        
| 450 | 480 | |
| 451 | - if (false !== $includeReference = $this->loadAliases($className))  | 
                                                        |
| 452 | - return $includeReference;  | 
                                                        |
| 481 | +			if (false !== $includeReference = $this->loadAliases($className)) { | 
                                                        |
| 482 | + return $includeReference;  | 
                                                        |
| 483 | + }  | 
                                                        |
| 453 | 484 | |
| 454 | - if (false !== $includeReference = $this->loadPrefixes($className))  | 
                                                        |
| 455 | - return $includeReference;  | 
                                                        |
| 485 | +			if (false !== $includeReference = $this->loadPrefixes($className)) { | 
                                                        |
| 486 | + return $includeReference;  | 
                                                        |
| 487 | + }  | 
                                                        |
| 456 | 488 | |
| 457 | - if (false !== $includeReference = $this->loadLastResort($className))  | 
                                                        |
| 458 | - return $includeReference;  | 
                                                        |
| 489 | +			if (false !== $includeReference = $this->loadLastResort($className)) { | 
                                                        |
| 490 | + return $includeReference;  | 
                                                        |
| 491 | + }  | 
                                                        |
| 459 | 492 | |
| 460 | 493 | static::seen($className, true);  | 
                                                        
| 461 | 494 | return null;  | 
                                                        
@@ -21,8 +21,8 @@ discard block  | 
                                                    ||
| 21 | 21 | abstract public function geometryN($n);  | 
                                                        
| 22 | 22 | abstract public function startPoint();  | 
                                                        
| 23 | 23 | abstract public function endPoint();  | 
                                                        
| 24 | - abstract public function isRing(); // Mssing dependancy  | 
                                                        |
| 25 | - abstract public function isClosed(); // Missing dependancy  | 
                                                        |
| 24 | + abstract public function isRing(); // Mssing dependancy  | 
                                                        |
| 25 | + abstract public function isClosed(); // Missing dependancy  | 
                                                        |
| 26 | 26 | abstract public function numPoints();  | 
                                                        
| 27 | 27 | abstract public function pointN($n);  | 
                                                        
| 28 | 28 | abstract public function exteriorRing();  | 
                                                        
@@ -67,7 +67,7 @@ discard block  | 
                                                    ||
| 67 | 67 | }  | 
                                                        
| 68 | 68 | |
| 69 | 69 | $bbox = $this->getBBox();  | 
                                                        
| 70 | - $points = array (  | 
                                                        |
| 70 | + $points = array(  | 
                                                        |
| 71 | 71 | new Point($bbox['maxx'], $bbox['miny']),  | 
                                                        
| 72 | 72 | new Point($bbox['maxx'], $bbox['maxy']),  | 
                                                        
| 73 | 73 | new Point($bbox['minx'], $bbox['maxy']),  | 
                                                        
@@ -60,7 +60,9 @@  | 
                                                    ||
| 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());  | 
                                                        
@@ -52,8 +52,8 @@ discard block  | 
                                                    ||
| 52 | 52 | * */  | 
                                                        
| 53 | 53 | public function invertxy()  | 
                                                        
| 54 | 54 |  	{ | 
                                                        
| 55 | -		for ($i=0;$i<count($this->components);$i++) { | 
                                                        |
| 56 | - if ( method_exists($this->components[$i], 'invertxy') )  | 
                                                        |
| 55 | +		for ($i = 0; $i < count($this->components); $i++) { | 
                                                        |
| 56 | + if (method_exists($this->components[$i], 'invertxy'))  | 
                                                        |
| 57 | 57 | $this->components[$i]->invertxy();  | 
                                                        
| 58 | 58 | }  | 
                                                        
| 59 | 59 | }  | 
                                                        
@@ -172,8 +172,8 @@ discard block  | 
                                                    ||
| 172 | 172 | public function geometryN($n)  | 
                                                        
| 173 | 173 |  	{ | 
                                                        
| 174 | 174 | $n = intval($n);  | 
                                                        
| 175 | -		if (array_key_exists($n-1, $this->components)) { | 
                                                        |
| 176 | - return $this->components[$n-1];  | 
                                                        |
| 175 | +		if (array_key_exists($n - 1, $this->components)) { | 
                                                        |
| 176 | + return $this->components[$n - 1];  | 
                                                        |
| 177 | 177 |  		} else { | 
                                                        
| 178 | 178 | return null;  | 
                                                        
| 179 | 179 | }  | 
                                                        
@@ -53,14 +53,17 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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;  | 
                                                        
@@ -95,9 +95,9 @@  | 
                                                    ||
| 95 | 95 | * */  | 
                                                        
| 96 | 96 | public function invertxy()  | 
                                                        
| 97 | 97 |  	{ | 
                                                        
| 98 | - $x=$this->coords[0];  | 
                                                        |
| 99 | - $this->coords[0]=$this->coords[1];  | 
                                                        |
| 100 | - $this->coords[1]=$x;  | 
                                                        |
| 98 | + $x = $this->coords[0];  | 
                                                        |
| 99 | + $this->coords[0] = $this->coords[1];  | 
                                                        |
| 100 | + $this->coords[1] = $x;  | 
                                                        |
| 101 | 101 | }  | 
                                                        
| 102 | 102 | |
| 103 | 103 | |
@@ -83,7 +83,9 @@  | 
                                                    ||
| 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 | /**  | 
                                                        
@@ -80,7 +80,7 @@ discard block  | 
                                                    ||
| 80 | 80 |  		foreach ($this->getPoints() as $delta => $point) { | 
                                                        
| 81 | 81 | $previous_point = $this->geometryN($delta);  | 
                                                        
| 82 | 82 |  			if ($previous_point) { | 
                                                        
| 83 | - $length += sqrt(pow(($previous_point->getX() - $point->getX()), 2) + pow(($previous_point->getY()- $point->getY()), 2));  | 
                                                        |
| 83 | + $length += sqrt(pow(($previous_point->getX() - $point->getX()), 2) + pow(($previous_point->getY() - $point->getY()), 2));  | 
                                                        |
| 84 | 84 | }  | 
                                                        
| 85 | 85 | }  | 
                                                        
| 86 | 86 | return $length;  | 
                                                        
@@ -90,10 +90,10 @@ discard block  | 
                                                    ||
| 90 | 90 |  	{ | 
                                                        
| 91 | 91 | $length = 0;  | 
                                                        
| 92 | 92 | $points = $this->getPoints();  | 
                                                        
| 93 | -		for ($i=0; $i<$this->numPoints()-1; $i++) { | 
                                                        |
| 93 | +		for ($i = 0; $i < $this->numPoints() - 1; $i++) { | 
                                                        |
| 94 | 94 | $point = $points[$i];  | 
                                                        
| 95 | - $next_point = $points[$i+1];  | 
                                                        |
| 96 | -			if (!is_object($next_point)) {continue;} | 
                                                        |
| 95 | + $next_point = $points[$i + 1];  | 
                                                        |
| 96 | +			if (!is_object($next_point)) {continue; } | 
                                                        |
| 97 | 97 | // Great circle method  | 
                                                        
| 98 | 98 | $lat1 = deg2rad($point->getY());  | 
                                                        
| 99 | 99 | $lat2 = deg2rad($next_point->getY());  | 
                                                        
@@ -119,10 +119,10 @@ discard block  | 
                                                    ||
| 119 | 119 |  	{ | 
                                                        
| 120 | 120 | $degrees = 0;  | 
                                                        
| 121 | 121 | $points = $this->getPoints();  | 
                                                        
| 122 | -		for ($i=0; $i<$this->numPoints()-1; $i++) { | 
                                                        |
| 122 | +		for ($i = 0; $i < $this->numPoints() - 1; $i++) { | 
                                                        |
| 123 | 123 | $point = $points[$i];  | 
                                                        
| 124 | - $next_point = $points[$i+1];  | 
                                                        |
| 125 | -			if (!is_object($next_point)) {continue;} | 
                                                        |
| 124 | + $next_point = $points[$i + 1];  | 
                                                        |
| 125 | +			if (!is_object($next_point)) {continue; } | 
                                                        |
| 126 | 126 | $degree = rad2deg(  | 
                                                        
| 127 | 127 | acos(  | 
                                                        
| 128 | 128 | sin(deg2rad($point->getY())) * sin(deg2rad($next_point->getY())) +  | 
                                                        
@@ -142,8 +142,8 @@ discard block  | 
                                                    ||
| 142 | 142 | $points = $this->getPoints();  | 
                                                        
| 143 | 143 | |
| 144 | 144 |  		foreach ($points as $i => $point) { | 
                                                        
| 145 | -			if (isset($points[$i+1])) { | 
                                                        |
| 146 | - $parts[] = new LineString(array($point, $points[$i+1]));  | 
                                                        |
| 145 | +			if (isset($points[$i + 1])) { | 
                                                        |
| 146 | + $parts[] = new LineString(array($point, $points[$i + 1]));  | 
                                                        |
| 147 | 147 | }  | 
                                                        
| 148 | 148 | }  | 
                                                        
| 149 | 149 | return $parts;  | 
                                                        
@@ -182,8 +182,8 @@ discard block  | 
                                                    ||
| 182 | 182 | $p3_x = $segment->endPoint()->x();  | 
                                                        
| 183 | 183 | $p3_y = $segment->endPoint()->y();  | 
                                                        
| 184 | 184 | |
| 185 | - $s1_x = $p1_x - $p0_x; $s1_y = $p1_y - $p0_y;  | 
                                                        |
| 186 | - $s2_x = $p3_x - $p2_x; $s2_y = $p3_y - $p2_y;  | 
                                                        |
| 185 | + $s1_x = $p1_x - $p0_x; $s1_y = $p1_y - $p0_y;  | 
                                                        |
| 186 | + $s2_x = $p3_x - $p2_x; $s2_y = $p3_y - $p2_y;  | 
                                                        |
| 187 | 187 | |
| 188 | 188 | $fps = (-$s2_x * $s1_y) + ($s1_x * $s2_y);  | 
                                                        
| 189 | 189 | $fpt = (-$s2_x * $s1_y) + ($s1_x * $s2_y);  | 
                                                        
@@ -193,7 +193,7 @@ discard block  | 
                                                    ||
| 193 | 193 | }  | 
                                                        
| 194 | 194 | |
| 195 | 195 | $s = (-$s1_y * ($p0_x - $p2_x) + $s1_x * ($p0_y - $p2_y)) / $fps;  | 
                                                        
| 196 | - $t = ( $s2_x * ($p0_y - $p2_y) - $s2_y * ($p0_x - $p2_x)) / $fpt;  | 
                                                        |
| 196 | + $t = ($s2_x * ($p0_y - $p2_y) - $s2_y * ($p0_x - $p2_x)) / $fpt;  | 
                                                        |
| 197 | 197 | |
| 198 | 198 |  		if ($s > 0 && $s < 1 && $t > 0 && $t < 1) { | 
                                                        
| 199 | 199 | // Collision detected  | 
                                                        
@@ -62,7 +62,9 @@  | 
                                                    ||
| 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 | |
@@ -76,8 +76,8 @@ discard block  | 
                                                    ||
| 76 | 76 | $cn['y'] = $cn['y'] + ($p->getY() + $pts[$j]->getY()) * $P;  | 
                                                        
| 77 | 77 | }  | 
                                                        
| 78 | 78 | |
| 79 | - $cn['x'] = $cn['x'] / ( 6 * $a);  | 
                                                        |
| 80 | - $cn['y'] = $cn['y'] / ( 6 * $a);  | 
                                                        |
| 79 | + $cn['x'] = $cn['x'] / (6 * $a);  | 
                                                        |
| 80 | + $cn['y'] = $cn['y'] / (6 * $a);  | 
                                                        |
| 81 | 81 | |
| 82 | 82 | $centroid = new Point($cn['x'], $cn['y']);  | 
                                                        
| 83 | 83 | return $centroid;  | 
                                                        
@@ -115,12 +115,12 @@ discard block  | 
                                                    ||
| 115 | 115 | public function numInteriorRings()  | 
                                                        
| 116 | 116 |  	{ | 
                                                        
| 117 | 117 | if ($this->isEmpty()) return 0;  | 
                                                        
| 118 | - return $this->numGeometries()-1;  | 
                                                        |
| 118 | + return $this->numGeometries() - 1;  | 
                                                        |
| 119 | 119 | }  | 
                                                        
| 120 | 120 | |
| 121 | 121 | public function interiorRingN($n)  | 
                                                        
| 122 | 122 |  	{ | 
                                                        
| 123 | - return $this->geometryN($n+1);  | 
                                                        |
| 123 | + return $this->geometryN($n + 1);  | 
                                                        |
| 124 | 124 | }  | 
                                                        
| 125 | 125 | |
| 126 | 126 | public function dimension()  | 
                                                        
@@ -172,8 +172,8 @@ discard block  | 
                                                    ||
| 172 | 172 | $intersections = 0;  | 
                                                        
| 173 | 173 | $vertices_count = count($vertices);  | 
                                                        
| 174 | 174 | |
| 175 | -		for ($i=1; $i < $vertices_count; $i++) { | 
                                                        |
| 176 | - $vertex1 = $vertices[$i-1];  | 
                                                        |
| 175 | +		for ($i = 1; $i < $vertices_count; $i++) { | 
                                                        |
| 176 | + $vertex1 = $vertices[$i - 1];  | 
                                                        |
| 177 | 177 | $vertex2 = $vertices[$i];  | 
                                                        
| 178 | 178 | if ($vertex1->y() == $vertex2->y()  | 
                                                        
| 179 | 179 | && $vertex1->y() == $point->y()  | 
                                                        
@@ -16,7 +16,9 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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 | |
@@ -94,8 +94,8 @@ discard block  | 
                                                    ||
| 94 | 94 |  		$parts = explode('),(', $data_string); | 
                                                        
| 95 | 95 | $lines = array();  | 
                                                        
| 96 | 96 |  		foreach ($parts as $part) { | 
                                                        
| 97 | -			if (!$this->beginsWith($part, '(')) $part = '(' . $part; | 
                                                        |
| 98 | - if (!$this->endsWith($part, ')')) $part = $part . ')';  | 
                                                        |
| 97 | +			if (!$this->beginsWith($part, '(')) $part = '('.$part; | 
                                                        |
| 98 | + if (!$this->endsWith($part, ')')) $part = $part.')';  | 
                                                        |
| 99 | 99 | $lines[] = $this->parseLineString($part);  | 
                                                        
| 100 | 100 | }  | 
                                                        
| 101 | 101 | return new Polygon($lines);  | 
                                                        
@@ -127,8 +127,8 @@ discard block  | 
                                                    ||
| 127 | 127 | $lines = array();  | 
                                                        
| 128 | 128 |  		foreach ($parts as $part) { | 
                                                        
| 129 | 129 | // Repair the string if the explode broke it  | 
                                                        
| 130 | -			if (!$this->beginsWith($part, '(')) $part = '(' . $part; | 
                                                        |
| 131 | - if (!$this->endsWith($part, ')')) $part = $part . ')';  | 
                                                        |
| 130 | +			if (!$this->beginsWith($part, '(')) $part = '('.$part; | 
                                                        |
| 131 | + if (!$this->endsWith($part, ')')) $part = $part.')';  | 
                                                        |
| 132 | 132 | $lines[] = $this->parseLineString($part);  | 
                                                        
| 133 | 133 | }  | 
                                                        
| 134 | 134 | return new MultiLineString($lines);  | 
                                                        
@@ -145,8 +145,8 @@ discard block  | 
                                                    ||
| 145 | 145 | $polys = array();  | 
                                                        
| 146 | 146 |  		foreach ($parts as $part) { | 
                                                        
| 147 | 147 | // Repair the string if the explode broke it  | 
                                                        
| 148 | -			if (!$this->beginsWith($part, '((')) $part = '((' . $part; | 
                                                        |
| 149 | - if (!$this->endsWith($part, '))')) $part = $part . '))';  | 
                                                        |
| 148 | +			if (!$this->beginsWith($part, '((')) $part = '(('.$part; | 
                                                        |
| 149 | + if (!$this->endsWith($part, '))')) $part = $part.'))';  | 
                                                        |
| 150 | 150 | $polys[] = $this->parsePolygon($part);  | 
                                                        
| 151 | 151 | }  | 
                                                        
| 152 | 152 | return new MultiPolygon($polys);  | 
                                                        
@@ -63,7 +63,9 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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 | /**  | 
                                                        
@@ -54,14 +54,14 @@ discard block  | 
                                                    ||
| 54 | 54 | $xmlobj = new DOMDocument();  | 
                                                        
| 55 | 55 | @$xmlobj->loadXML($text);  | 
                                                        
| 56 | 56 |  		if ($xmlobj === false) { | 
                                                        
| 57 | -			throw new Exception("Invalid GPX: ". $text); | 
                                                        |
| 57 | +			throw new Exception("Invalid GPX: ".$text); | 
                                                        |
| 58 | 58 | }  | 
                                                        
| 59 | 59 | |
| 60 | 60 | $this->xmlobj = $xmlobj;  | 
                                                        
| 61 | 61 |  		try { | 
                                                        
| 62 | 62 | $geom = $this->geomFromXML();  | 
                                                        
| 63 | 63 |  		} catch (InvalidText $e) { | 
                                                        
| 64 | -			throw new Exception("Cannot Read Geometry From GPX: ". $text); | 
                                                        |
| 64 | +			throw new Exception("Cannot Read Geometry From GPX: ".$text); | 
                                                        |
| 65 | 65 |  		} catch (Exception $e) { | 
                                                        
| 66 | 66 | throw $e;  | 
                                                        
| 67 | 67 | }  | 
                                                        
@@ -119,7 +119,7 @@ discard block  | 
                                                    ||
| 119 | 119 | $components[] = new Point($lon, $lat);  | 
                                                        
| 120 | 120 | }  | 
                                                        
| 121 | 121 | }  | 
                                                        
| 122 | -			if ($components) {$lines[] = new LineString($components);} | 
                                                        |
| 122 | +			if ($components) {$lines[] = new LineString($components); } | 
                                                        |
| 123 | 123 | }  | 
                                                        
| 124 | 124 | return $lines;  | 
                                                        
| 125 | 125 | }  | 
                                                        
@@ -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.':';  |