@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | trigger_error('Current co-ordinates are in a non-WGS84 datum', E_USER_WARNING); |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - $longitudeZone = (int)(($this->lng + 180) / 6) + 1; |
|
| 386 | + $longitudeZone = (int) (($this->lng + 180) / 6) + 1; |
|
| 387 | 387 | |
| 388 | 388 | // Special zone for Norway |
| 389 | 389 | if ($this->lat >= 56 && $this->lat < 64 && $this->lng >= 3 && $this->lng < 12) { |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | $zones = "CDEFGHJKLMNPQRSTUVWXX"; |
| 443 | - $zoneIndex = (int)(($latitude + 80) / 8); |
|
| 443 | + $zoneIndex = (int) (($latitude + 80) / 8); |
|
| 444 | 444 | return $zones[$zoneIndex]; |
| 445 | 445 | } |
| 446 | 446 | |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | |
| 75 | 75 | //first (major) letter is the 500km grid sq, origin at -1000000, -500000 |
| 76 | - $majorEasting = strpos(self::GRID_LETTERS, $ref[0]) % 5 * 500000 - 1000000; |
|
| 76 | + $majorEasting = strpos(self::GRID_LETTERS, $ref[0]) % 5 * 500000 - 1000000; |
|
| 77 | 77 | $majorNorthing = (floor(strpos(self::GRID_LETTERS, $ref[0]) / 5)) * 500000 - 500000; |
| 78 | 78 | |
| 79 | 79 | //second (minor) letter is 100km grid sq, origin at 0,0 of this square |
| 80 | - $minorEasting = strpos(self::GRID_LETTERS, $ref[1]) % 5 * 100000; |
|
| 80 | + $minorEasting = strpos(self::GRID_LETTERS, $ref[1]) % 5 * 100000; |
|
| 81 | 81 | $minorNorthing = (floor(strpos(self::GRID_LETTERS, $ref[1]) / 5)) * 100000; |
| 82 | 82 | |
| 83 | 83 | $easting = $majorEasting + $minorEasting + (substr($ref, 2, 3) * 100); |
@@ -105,16 +105,16 @@ discard block |
||
| 105 | 105 | $adjustedY = $this->y + 500000; |
| 106 | 106 | $majorSquaresEast = floor($adjustedX / 500000); |
| 107 | 107 | $majorSquaresNorth = floor($adjustedY / 500000); |
| 108 | - $majorLetterIndex = (int)(5 * $majorSquaresNorth + $majorSquaresEast); |
|
| 108 | + $majorLetterIndex = (int) (5 * $majorSquaresNorth + $majorSquaresEast); |
|
| 109 | 109 | $majorLetter = substr(self::GRID_LETTERS, $majorLetterIndex, 1); |
| 110 | 110 | |
| 111 | 111 | //second (minor) letter is 100km grid sq, origin at 0,0 of this square |
| 112 | 112 | $minorSquaresEast = $easting[0] % 5; |
| 113 | 113 | $minorSquaresNorth = $northing[0] % 5; |
| 114 | - $minorLetterIndex = (int)(5 * $minorSquaresNorth + $minorSquaresEast); |
|
| 114 | + $minorLetterIndex = (int) (5 * $minorSquaresNorth + $minorSquaresEast); |
|
| 115 | 115 | $minorLetter = substr(self::GRID_LETTERS, $minorLetterIndex, 1); |
| 116 | 116 | |
| 117 | - return $majorLetter . $minorLetter . substr($easting, 1, $halfLength) . substr($northing, 1, $halfLength); |
|
| 117 | + return $majorLetter.$minorLetter.substr($easting, 1, $halfLength).substr($northing, 1, $halfLength); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public static function fromSixFigureReference($ref) |
| 69 | 69 | { |
| 70 | 70 | |
| 71 | - $easting = strpos(self::GRID_LETTERS, $ref[0]) % 5 * 100000 + (substr($ref, 1, 3) * 100); |
|
| 71 | + $easting = strpos(self::GRID_LETTERS, $ref[0]) % 5 * 100000 + (substr($ref, 1, 3) * 100); |
|
| 72 | 72 | $northing = (floor(strpos(self::GRID_LETTERS, $ref[0]) / 5)) * 100000 + (substr($ref, 4, 3) * 100); |
| 73 | 73 | |
| 74 | 74 | return new IrishGridRef($easting, $northing); |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | //100km grid sq, origin at 0,0 |
| 90 | 90 | $minorSquaresEast = $easting[0] % 5; |
| 91 | 91 | $minorSquaresNorth = $northing[0] % 5; |
| 92 | - $minorLetterIndex = (int)(5 * $minorSquaresNorth + $minorSquaresEast); |
|
| 92 | + $minorLetterIndex = (int) (5 * $minorSquaresNorth + $minorSquaresEast); |
|
| 93 | 93 | $minorLetter = substr(self::GRID_LETTERS, $minorLetterIndex, 1); |
| 94 | 94 | |
| 95 | - return $minorLetter . substr($easting, 1, 3) . substr($northing, 1, 3); |
|
| 95 | + return $minorLetter.substr($easting, 1, 3).substr($northing, 1, 3); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -218,8 +218,8 @@ |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | //Because this is a 2D grid, we can use simple Pythagoras |
| 221 | - $distanceX = $to->getX()-$this->getX(); |
|
| 222 | - $distanceY = $to->getY()-$this->getY(); |
|
| 221 | + $distanceX = $to->getX() - $this->getX(); |
|
| 222 | + $distanceY = $to->getY() - $this->getY(); |
|
| 223 | 223 | |
| 224 | 224 | return pow(pow($distanceX, 2) + pow($distanceY, 2), 0.5); |
| 225 | 225 | |