CakeRequest::_headerDetector PHP Method

_headerDetector() protected method

Detects if a specific header is present.
protected _headerDetector ( array $detect ) : boolean
$detect array Detector options array.
return boolean Whether or not the request is the type you are checking.
    protected function _headerDetector($detect)
    {
        foreach ($detect['header'] as $header => $value) {
            $header = env('HTTP_' . strtoupper($header));
            if (!is_null($header)) {
                if (!is_string($value) && !is_bool($value) && is_callable($value)) {
                    return call_user_func($value, $header);
                }
                return $header === $value;
            }
        }
        return false;
    }