Skip to content

Commit

Permalink
Merge pull request #6051 from valmorflores/patch-2
Browse files Browse the repository at this point in the history
Small change to improve code reading
  • Loading branch information
paulbalandan authored May 31, 2022
2 parents 0c66d6b + f970ac2 commit f012cc7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions system/Validation/FormatRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,19 @@ public function valid_ip(?string $ip = null, ?string $which = null): bool

switch (strtolower($which ?? '')) {
case 'ipv4':
$which = FILTER_FLAG_IPV4;
$option = FILTER_FLAG_IPV4;
break;

case 'ipv6':
$which = FILTER_FLAG_IPV6;
$option = FILTER_FLAG_IPV6;
break;

default:
$which = 0;
$option = 0;
}

return filter_var($ip, FILTER_VALIDATE_IP, $which) !== false
|| (! ctype_print($ip) && filter_var(inet_ntop($ip), FILTER_VALIDATE_IP, $which) !== false);
return filter_var($ip, FILTER_VALIDATE_IP, $option) !== false
|| (! ctype_print($ip) && filter_var(inet_ntop($ip), FILTER_VALIDATE_IP, $option) !== false);
}

/**
Expand Down

0 comments on commit f012cc7

Please sign in to comment.