Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Mgrs/LatLong.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function normalizeLatitude($latitude) {
*/

public function normalizeLongitude($longitude) {
if (180 === $longitude % 360) {
if (180 === fmod($longitude, 360)) {
return 180.0;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Mgrs/Mgrs.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function toGridReference($template = null, $accuracy = null) {

$seasting = (string)$this->getEasting();
$snorthing = (string)$this->getNorthing();

$fields = array(
// The zone number.
'%z' => $this->getZoneNumber(),
Expand Down Expand Up @@ -477,7 +477,7 @@ public static function fromGridReference($mgrs_reference) {
$northing,
$easting,
$zone_number,
$zone_letter
$zone_letter,
);

// Set the accuracy according to the number of digits found.
Expand All @@ -502,11 +502,11 @@ public static function fromGridReference($mgrs_reference) {

protected static function getEastingFromChar($e, $set) {
// colOrigin is the letter at the origin of the set for the column.
$curCol = substr(static::SET_ORIGIN_COLUMN_LETTERS, $set - 1, 1);
$curCol = ord(substr(static::SET_ORIGIN_COLUMN_LETTERS, $set - 1, 1));
$eastingValue = 100000.0;
$rewindMarker = false;

while ($curCol !== substr($e, 0, 1)) {
while ($curCol !== ord(substr($e, 0, 1))) {
$curCol++;

if ($curCol === static::I) {
Expand Down Expand Up @@ -551,7 +551,7 @@ protected static function getEastingFromChar($e, $set) {
* @todo Better name: use "letter" rather than "char" and show this is just the second letter.
*/

protected function getNorthingFromChar($n, $set) {
protected static function getNorthingFromChar($n, $set) {
if ($n > 'V') {
throw new \Exception("MGRSPoint given invalid Northing " . $n);
}
Expand Down