original_string: public function ensureVaryHeader(HttpResponse $response)
      {
          $headers = $response->getHeaders();
          // If the origin is not "*", we should add the "Origin" value to the "Vary" header
          // See more: http://www.w3.org/TR/cors/#resource-implementation
          $allowedOrigins = $this->options->getAllowedOrigins();
  
          if (in_array('*', $allowedOrigins)) {
              return $headers;
          }
          if ($headers->has('Vary')) {
              $varyHeader = $headers->get('Vary');
              $varyValue  = $varyHeader->getFieldValue() . ', Origin';
  
              $headers->removeHeader($varyHeader);
              $headers->addHeaderLine('Vary', $varyValue);
          } else {
              $headers->addHeaderLine('Vary', 'Origin');
          }
  
          return $headers;
      }
code: public function ensureVaryHeader(HttpResponse $response)
      {
          $headers = $response->getHeaders();
          // If the origin is not "*", we should add the "Origin" value to the "Vary" header
          // See more: http://www.w3.org/TR/cors/#resource-implementation
          $allowedOrigins = $this->options->getAllowedOrigins();
  
          if (in_array('*', $allowedOrigins)) {
              return $headers;
          }
          if ($headers->has('Vary')) {
              $varyHeader = $headers->get('Vary');
              $varyValue  = $varyHeader->getFieldValue() . ', Origin';
  
              $headers->removeHeader($varyHeader);
              $headers->addHeaderLine('Vary', $varyValue);
          } else {
              $headers->addHeaderLine('Vary', 'Origin');
          }
  
          return $headers;
      }
code_tokens: public function ensureVaryHeader ( HttpResponse $ response ) { $ headers = $ response -> getHeaders ( ) ; // If the origin is not "*", we should add the "Origin" value to the "Vary" header // See more: http://www.w3.org/TR/cors/#resource-implementation $ allowedOrigins = $ this -> options -> getAllowedOrigins ( ) ; if ( in_array ( '*' , $ allowedOrigins ) ) { return $ headers ; } if ( $ headers -> has ( 'Vary' ) ) { $ varyHeader = $ headers -> get ( 'Vary' ) ; $ varyValue = $ varyHeader -> getFieldValue ( ) . ', Origin' ; $ headers -> removeHeader ( $ varyHeader ) ; $ headers -> addHeaderLine ( 'Vary' , $ varyValue ) ; } else { $ headers -> addHeaderLine ( 'Vary' , 'Origin' ) ; } return $ headers ; }
docstring: Ensure that the Vary header is set.
  
  
  @link http://www.w3.org/TR/cors/#resource-implementation
  @param HttpResponse $response
  @return \Zend\Http\Headers
docstring_tokens: Ensure that the Vary header is set .