yii\validators\IpValidator::setRanges PHP Method

setRanges() public method

The following preparation tasks are performed: - Recursively substitutes aliases (described in [[networks]]) with their values. - Removes duplicates
public setRanges ( array $ranges )
$ranges array the IPv4 or IPv6 ranges that are allowed or forbidden. When the array is empty, or the option not set, all IP addresses are allowed. Otherwise, the rules are checked sequentially until the first match is found. An IP address is forbidden, when it has not matched any of the rules. Example: ```php [ 'ranges' => [ '192.168.10.128' '!192.168.10.0/24', 'any' // allows any other IP addresses ] ] ``` In this example, access is allowed for all the IPv4 and IPv6 addresses excluding the `192.168.10.0/24` subnet. IPv4 address `192.168.10.128` is also allowed, because it is listed before the restriction.
    public function setRanges($ranges)
    {
        $this->_ranges = $this->prepareRanges((array) $ranges);
    }