src/IpRange/Ipv6Range.php
private function extractNetworkAndMaskFromRange($range)
    {
        if (false !== strpos($range, '/')) {
            // handle the CIDR notation
            list($network, $this->mask) = explode('/', $range);
            // store a substring of the binary representation of the range
            // minus the masked part
            $this->rangeSubstring = substr(
                $this->convertToBinaryString($network),
                0,
                $this->mask
            );
        } else {
            // handle a single IP address
            $this->rangeSubstring = $this->convertToBinaryString($range);
            $this->mask = false;
        }
    }
private function extractNetworkAndMaskFromRange($range)
    {
        if (false !== strpos($range, '/')) {
            // handle the CIDR notation
            list($network, $this->mask) = explode('/', $range);
            // store a substring of the binary representation of the range
            // minus the masked part
            $this->rangeSubstring = substr(
                $this->convertToBinaryString($network),
                0,
                $this->mask
            );
        } else {
            // handle a single IP address
            $this->rangeSubstring = $this->convertToBinaryString($range);
            $this->mask = false;
        }
    }
private function extractNetworkAndMaskFromRange ( $ range ) { if ( false !== strpos ( $ range , '/' ) ) { // handle the CIDR notation list ( $ network , $ this -> mask ) = explode ( '/' , $ range ) ; // store a substring of the binary representation of the range // minus the masked part $ this -> rangeSubstring = substr ( $ this -> convertToBinaryString ( $ network ) , 0 , $ this -> mask ) ; } else { // handle a single IP address $ this -> rangeSubstring = $ this -> convertToBinaryString ( $ range ) ; $ this -> mask = false ; } }
Extracts the mask and binary string substring of the range to compare
against incoming IP addresses.
@param string $range The IPv6 range as a string.
Extracts the mask and binary string substring of the range to compare against incoming IP addresses .