Skip to content

Commit

Permalink
Fixes validation discrepancy for non float values.
Browse files Browse the repository at this point in the history
  • Loading branch information
allebb authored Sep 19, 2016
1 parent bdc1f73 commit babe32f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Entities/LatLong.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ public function __construct($lat, $lng)
}
}

/**
* Validates the Latitude value.Tuesday12327
* @return boolean True if validation passes.
/**
* Validates the Latitude value.
*
* @return boolean
*/
private function validateLat()
{
return preg_match(self::LAT_VALIDATION_REGEX, $this->latitude);
if (($this->latitude >= -90) && ($this->latitude <= 90)) {
return true;
}
return false;
}

/**
Expand All @@ -72,7 +76,10 @@ private function validateLat()
*/
private function validateLng()
{
return preg_match(self::LNG_VALIDATION_REGEX, $this->longitude);
if (($this->longitude >= -180) && ($this->longitude <= 180)) {
return true;
}
return false;
}

/**
Expand Down

0 comments on commit babe32f

Please sign in to comment.