original_string: public function header($header = null, $value = null)
      {
          deprecationWarning(
              'Response::header() is deprecated. ' .
              'Use `withHeader()`, `getHeaderLine()` and `getHeaders()` instead.'
          );
  
          if ($header === null) {
              return $this->getSimpleHeaders();
          }
  
          $headers = is_array($header) ? $header : [$header => $value];
          foreach ($headers as $header => $value) {
              if (is_numeric($header)) {
                  list($header, $value) = [$value, null];
              }
              if ($value === null) {
                  list($header, $value) = explode(':', $header, 2);
              }
  
              $lower = strtolower($header);
              if (array_key_exists($lower, $this->headerNames)) {
                  $header = $this->headerNames[$lower];
              } else {
                  $this->headerNames[$lower] = $header;
              }
  
              $this->headers[$header] = is_array($value) ? array_map('trim', $value) : [trim($value)];
          }
  
          return $this->getSimpleHeaders();
      }
code: public function header($header = null, $value = null)
      {
          deprecationWarning(
              'Response::header() is deprecated. ' .
              'Use `withHeader()`, `getHeaderLine()` and `getHeaders()` instead.'
          );
  
          if ($header === null) {
              return $this->getSimpleHeaders();
          }
  
          $headers = is_array($header) ? $header : [$header => $value];
          foreach ($headers as $header => $value) {
              if (is_numeric($header)) {
                  list($header, $value) = [$value, null];
              }
              if ($value === null) {
                  list($header, $value) = explode(':', $header, 2);
              }
  
              $lower = strtolower($header);
              if (array_key_exists($lower, $this->headerNames)) {
                  $header = $this->headerNames[$lower];
              } else {
                  $this->headerNames[$lower] = $header;
              }
  
              $this->headers[$header] = is_array($value) ? array_map('trim', $value) : [trim($value)];
          }
  
          return $this->getSimpleHeaders();
      }
code_tokens: public function header ( $ header = null , $ value = null ) { deprecationWarning ( 'Response::header() is deprecated. ' . 'Use `withHeader()`, `getHeaderLine()` and `getHeaders()` instead.' ) ; if ( $ header === null ) { return $ this -> getSimpleHeaders ( ) ; } $ headers = is_array ( $ header ) ? $ header : [ $ header => $ value ] ; foreach ( $ headers as $ header => $ value ) { if ( is_numeric ( $ header ) ) { list ( $ header , $ value ) = [ $ value , null ] ; } if ( $ value === null ) { list ( $ header , $ value ) = explode ( ':' , $ header , 2 ) ; } $ lower = strtolower ( $ header ) ; if ( array_key_exists ( $ lower , $ this -> headerNames ) ) { $ header = $ this -> headerNames [ $ lower ] ; } else { $ this -> headerNames [ $ lower ] = $ header ; } $ this -> headers [ $ header ] = is_array ( $ value ) ? array_map ( 'trim' , $ value ) : [ trim ( $ value ) ] ; } return $ this -> getSimpleHeaders ( ) ; }
docstring: Buffers a header string to be sent
  Returns the complete list of buffered headers
  
  ### Single header
  ```
  header('Location', 'http://example.com');
  ```
  
  ### Multiple headers
  ```
  header(['Location' => 'http://example.com', 'X-Extra' => 'My header']);
  ```
  
  ### String header
  ```
  header('WWW-Authenticate: Negotiate');
  ```
  
  ### Array of string headers
  ```
  header(['WWW-Authenticate: Negotiate', 'Content-type: application/pdf']);
  ```
  
  Multiple calls for setting the same header name will have the same effect as setting the header once
  with the last value sent for it
  ```
  header('WWW-Authenticate: Negotiate');
  header('WWW-Authenticate: Not-Negotiate');
  ```
  will have the same effect as only doing
  ```
  header('WWW-Authenticate: Not-Negotiate');
  ```
  
  @param string|array|null $header An array of header strings or a single header string
  - an associative array of "header name" => "header value" is also accepted
  - an array of string headers is also accepted
  @param string|array|null $value The header value(s)
  @return array List of headers to be sent
  @deprecated 3.4.0 Use `withHeader()`, `getHeaderLine()` and `getHeaders()` instead.
docstring_tokens: Buffers a header string to be sent Returns the complete list of buffered headers