protected static function collapseHeaders(PsrResponse $response)
    {
        $out = [];
        foreach ($response->getHeaders() as $name => $value) {
            if (count($value) === 1) {
                $out[$name] = $value[0];
            } else {
                $out[$name] = $value;
            }
        }

        return $out;
    }
protected static function collapseHeaders(PsrResponse $response)
    {
        $out = [];
        foreach ($response->getHeaders() as $name => $value) {
            if (count($value) === 1) {
                $out[$name] = $value[0];
            } else {
                $out[$name] = $value;
            }
        }

        return $out;
    }
protected static function collapseHeaders ( PsrResponse $ response ) { $ out = [ ] ; foreach ( $ response -> getHeaders ( ) as $ name => $ value ) { if ( count ( $ value ) === 1 ) { $ out [ $ name ] = $ value [ 0 ] ; } else { $ out [ $ name ] = $ value ; } } return $ out ; }
Convert a PSR7 Response headers into a flat array

@param \Psr\Http\Message\ResponseInterface $response The response to convert.
@return array Headers.
Convert a PSR7 Response headers into a flat array