public function __construct($ipAddress) { $this->m_ipAddress = $ipAddress; $tokens = explode(".", $ipAddress); if (count($tokens) > 4) { throw new ConfigurationException("invalid ip address - cannot parse. " + $ipAddress); } foreach ($tokens as $token) { $comparator = null; if ($token == "*") { $comparator = AnyTokenComparator::getInstance(); $this->m_isMask = true; } else { $comparator = new TokenComparator($token); } $this->m_ipAddressTokens[] = $comparator; } }
public function __construct($hostName) { $this->m_hostName = $hostName; $this->m_isLocalHost = $hostName == "localhost"; $this->m_isMask = false; if ($this->m_isLocalHost) { $this->initLocalHost(); } $hostNameParts = split(".", $hostName); foreach ($hostNameParts as $token) { $comparator = null; if ($token == "*") { $comparator = AnyTokenComparator::getInstance(); $this->m_isMask = true; } else { $comparator = new TokenComparator($token); } $this->m_comparators[] = $comparator; } }