src/Whitelist/Check.php
public function whitelist(array $whitelist)
	{
		$this->_definitions = array();
		
		foreach ($whitelist as $definition)
		{
			// Pre-configured object
			if (is_object($definition))
			{
				if ($definition instanceof Definition\IDefinition)
					$definitionObject = $definition;
				else
					throw new \InvalidArgumentException('Definition objects must implement IDefinition');
			}
			// IPv4 address
			elseif (preg_match('/[a-z:\/]/', $definition) === 0)
				$definitionObject = new Definition\IPv4Address($definition);
			// IPv4 CIDR notation
			elseif (preg_match('/[a-z:]/', $definition) === 0)
				$definitionObject = new Definition\IPv4CIDR($definition);
			// IPv6 address
			elseif (preg_match('/^[0-9a-f:]+$/', $definition))
				$definitionObject = new Definition\IPv6Address($definition);
			// IPv6 CIDR notation
			elseif (preg_match('/^[0-9a-f:\/]+$/', $definition))
				$definitionObject = new Definition\IPv6CIDR($definition);
			// Wildcard domain
			elseif (preg_match('/^\*\.[\w\.\-]+$/', $definition))
				$definitionObject = new Definition\WildcardDomain($definition);
			// Domain
			elseif (preg_match('/^[\w\.\-]+$/', $definition))
				$definitionObject = new Definition\Domain($definition);
			else
				throw new \InvalidArgumentException('Unable to parse definition "'.$definition.'"');

			$this->_definitions[] = $definitionObject;
		}
	}
public function whitelist(array $whitelist)
	{
		$this->_definitions = array();
		
		foreach ($whitelist as $definition)
		{
			// Pre-configured object
			if (is_object($definition))
			{
				if ($definition instanceof Definition\IDefinition)
					$definitionObject = $definition;
				else
					throw new \InvalidArgumentException('Definition objects must implement IDefinition');
			}
			// IPv4 address
			elseif (preg_match('/[a-z:\/]/', $definition) === 0)
				$definitionObject = new Definition\IPv4Address($definition);
			// IPv4 CIDR notation
			elseif (preg_match('/[a-z:]/', $definition) === 0)
				$definitionObject = new Definition\IPv4CIDR($definition);
			// IPv6 address
			elseif (preg_match('/^[0-9a-f:]+$/', $definition))
				$definitionObject = new Definition\IPv6Address($definition);
			// IPv6 CIDR notation
			elseif (preg_match('/^[0-9a-f:\/]+$/', $definition))
				$definitionObject = new Definition\IPv6CIDR($definition);
			// Wildcard domain
			elseif (preg_match('/^\*\.[\w\.\-]+$/', $definition))
				$definitionObject = new Definition\WildcardDomain($definition);
			// Domain
			elseif (preg_match('/^[\w\.\-]+$/', $definition))
				$definitionObject = new Definition\Domain($definition);
			else
				throw new \InvalidArgumentException('Unable to parse definition "'.$definition.'"');

			$this->_definitions[] = $definitionObject;
		}
	}
Parses the whitelist definitions into respective objects
@param array $whitelist list of definition strings
@throws \InvalidArgumentException if the definition type couldn't be
determined