yii\validators\IpValidator::isAllowed PHP Method

isAllowed() private method

The method checks whether the IP address with specified CIDR is allowed according to the [[ranges]] list.
See also: ranges
private isAllowed ( string $ip, integer $cidr ) : boolean
$ip string
$cidr integer
return boolean
    private function isAllowed($ip, $cidr)
    {
        if (empty($this->ranges)) {
            return true;
        }
        foreach ($this->ranges as $string) {
            list($isNegated, $range) = $this->parseNegatedRange($string);
            if ($this->inRange($ip, $cidr, $range)) {
                return !$isNegated;
            }
        }
        return false;
    }