Skip to content

Commit

Permalink
move empty check to validateIpAddress method
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Jan 8, 2019
1 parent 4b79a79 commit 1d24382
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ public function validateCountryCode(string $countryCode) : bool
*/
public function validateIpAddress(string $ipAddress) : bool
{
if (empty($ipAddress)) {
return false;
}

return (bool) filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE);
}

Expand All @@ -382,7 +386,7 @@ public function validateIpAddress(string $ipAddress) : bool
*/
public function ip(string $ipAddress) : string
{
if (empty($ipAddress) || !$this->validateIpAddress($ipAddress)) {
if (!$this->validateIpAddress($ipAddress)) {
return '';
}

Expand Down

0 comments on commit 1d24382

Please sign in to comment.