public function getHeader($header, $first = true)
    {
        $normalizedHeader = str_replace('-', '_', strtolower($header));
        foreach ($this->headers as $key => $value) {
            if (str_replace('-', '_', strtolower($key)) === $normalizedHeader) {
                if ($first) {
                    return is_array($value) ? (count($value) ? $value[0] : '') : $value;
                }

                return is_array($value) ? $value : array($value);
            }
        }

        return $first ? null : array();
    }
public function getHeader($header, $first = true)
    {
        $normalizedHeader = str_replace('-', '_', strtolower($header));
        foreach ($this->headers as $key => $value) {
            if (str_replace('-', '_', strtolower($key)) === $normalizedHeader) {
                if ($first) {
                    return is_array($value) ? (count($value) ? $value[0] : '') : $value;
                }

                return is_array($value) ? $value : array($value);
            }
        }

        return $first ? null : array();
    }
public function getHeader ( $ header , $ first = true ) { $ normalizedHeader = str_replace ( '-' , '_' , strtolower ( $ header ) ) ; foreach ( $ this -> headers as $ key => $ value ) { if ( str_replace ( '-' , '_' , strtolower ( $ key ) ) === $ normalizedHeader ) { if ( $ first ) { return is_array ( $ value ) ? ( count ( $ value ) ? $ value [ 0 ] : '' ) : $ value ; } return is_array ( $ value ) ? $ value : array ( $ value ) ; } } return $ first ? null : array ( ) ; }
Gets a response header.

@param string $header The header name
@param bool   $first  Whether to return the first value or all header values

@return string|array The first header value if $first is true, an array of values otherwise
Gets a response header .