CodeExplorer isValidIp example
private function isValidIps(string|array
$ips): bool
{ $ipsList =
array_reduce((array) $ips,
fn ($ips,
$ip) =>
array_merge($ips,
preg_split('/\s*,\s*/',
$ip)),
[]);
if (!
$ipsList) { return false;
} foreach ($ipsList as $cidr) { if (!
$this->
isValidIp($cidr)) { return false;
} } return true;
} private function isValidIp(string
$cidr): bool
{ $cidrParts =
explode('/',
$cidr);