original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Convert a PSR7 Response headers into a flat array
  
  @param \Psr\Http\Message\ResponseInterface $response The response to convert.
  @return array Headers.
docstring_tokens: Convert a PSR7 Response headers into a flat array