public function headers($key = null, $default = null, $nullIfEmpty = false) {
        if ($this->headers === null) {
            $result = array(); 

            foreach ($this->serverVariables as $k => $v)
            {
                if (substr($k, 0, 5) == 'HTTP_') 
                {
                    $headerName = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($k, 5)))));
                    $result[$headerName] = $v;
                }
            }

            $this->headers = $result;
        }

        return InternalHelper::getSingleKeyOrAll($this->headers, $key, $default, $nullIfEmpty);
    }
public function headers($key = null, $default = null, $nullIfEmpty = false) {
        if ($this->headers === null) {
            $result = array(); 

            foreach ($this->serverVariables as $k => $v)
            {
                if (substr($k, 0, 5) == 'HTTP_') 
                {
                    $headerName = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($k, 5)))));
                    $result[$headerName] = $v;
                }
            }

            $this->headers = $result;
        }

        return InternalHelper::getSingleKeyOrAll($this->headers, $key, $default, $nullIfEmpty);
    }
public function headers ( $ key = null , $ default = null , $ nullIfEmpty = false ) { if ( $ this -> headers === null ) { $ result = array ( ) ; foreach ( $ this -> serverVariables as $ k => $ v ) { if ( substr ( $ k , 0 , 5 ) == 'HTTP_' ) { $ headerName = str_replace ( ' ' , '-' , ucwords ( strtolower ( str_replace ( '_' , ' ' , substr ( $ k , 5 ) ) ) ) ) ; $ result [ $ headerName ] = $ v ; } } $ this -> headers = $ result ; } return InternalHelper :: getSingleKeyOrAll ( $ this -> headers , $ key , $ default , $ nullIfEmpty ) ; }
Returns HTTP headers of the request.

@param string|null $key The key to get. Default: null - all keys.
@param string|null $default The default value if the key is not null, and the value with the specified key was not found. The default value is null.
@param bool $nullIfEmpty Check the value with the empty() function. If empty() returns true, the function returns $default.

@return array|string
Returns HTTP headers of the request .