@@ -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 |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | { |
415 | 415 | $this->toWGS84(); |
416 | 416 | |
417 | - $longitudeZone = (int)(($this->lng + 180) / 6) + 1; |
|
417 | + $longitudeZone = (int) (($this->lng + 180) / 6) + 1; |
|
418 | 418 | |
419 | 419 | // Special zone for Norway |
420 | 420 | if ($this->lat >= 56 && $this->lat < 64 && $this->lng >= 3 && $this->lng < 12) { |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | } |
463 | 463 | |
464 | 464 | $zones = "CDEFGHJKLMNPQRSTUVWXX"; |
465 | - $zoneIndex = (int)(($latitude + 80) / 8); |
|
465 | + $zoneIndex = (int) (($latitude + 80) / 8); |
|
466 | 466 | return $zones[$zoneIndex]; |
467 | 467 | } |
468 | 468 |