Vectorface\Whip\Whip::__construct PHP Method

__construct() public method

Constructor for the class.
public __construct ( integer $enabled = self::ALL_METHODS, array $whitelists = [], mixed $source = null )
$enabled integer The bitmask of enabled headers.
$whitelists array The array of IP ranges to be whitelisted.
$source mixed A supported source of IP data.
    public function __construct($enabled = self::ALL_METHODS, array $whitelists = array(), $source = null)
    {
        $this->enabled = (int) $enabled;
        if (isset($source)) {
            $this->setSource($source);
        }
        $this->whitelist = array();
        foreach ($whitelists as $header => $ipRanges) {
            $header = $this->normalizeHeaderName($header);
            $this->whitelist[$header] = new IpWhitelist($ipRanges);
        }
    }