Jaybizzle\CrawlerDetect\CrawlerDetect::setHttpHeaders PHP Method

setHttpHeaders() public method

Set HTTP headers.
public setHttpHeaders ( array $httpHeaders = null )
$httpHeaders array
    public function setHttpHeaders($httpHeaders = null)
    {
        // Use global _SERVER if $httpHeaders aren't defined.
        if (!is_array($httpHeaders) || !count($httpHeaders)) {
            $httpHeaders = $_SERVER;
        }
        // Clear existing headers.
        $this->httpHeaders = array();
        // Only save HTTP headers. In PHP land, that means
        // only _SERVER vars that start with HTTP_.
        foreach ($httpHeaders as $key => $value) {
            if (substr($key, 0, 5) === 'HTTP_') {
                $this->httpHeaders[$key] = $value;
            }
        }
    }