Skip to content

Commit 1d24382

Browse files
move empty check to validateIpAddress method
1 parent 4b79a79 commit 1d24382

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Countries.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ public function validateCountryCode(string $countryCode) : bool
368368
*/
369369
public function validateIpAddress(string $ipAddress) : bool
370370
{
371+
if (empty($ipAddress)) {
372+
return false;
373+
}
374+
371375
return (bool) filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE);
372376
}
373377

@@ -382,7 +386,7 @@ public function validateIpAddress(string $ipAddress) : bool
382386
*/
383387
public function ip(string $ipAddress) : string
384388
{
385-
if (empty($ipAddress) || !$this->validateIpAddress($ipAddress)) {
389+
if (!$this->validateIpAddress($ipAddress)) {
386390
return '';
387391
}
388392

0 commit comments

Comments
 (0)