original_string: public function addHeader($key, $value = null, $toLower = true)
      {
          if (is_array($key)) {
              foreach ($key as $k => $v) {
                  $this->addHeader($k, $v);
              }
          } else {
              if ($value !== null) {
                  if ($toLower === true) {
                      $key = strtolower($key);
                  }
                  if (!isset($this->_headers[$key])) {
                      $this->_headers[$key] = $value;
                  } else {
                      if (is_array($this->_headers[$key])) {
                          $this->_headers[$key][] = $value;
                      } else {
                          $this->_headers[$key] = [$this->_headers[$key], $value];
                      }
                  }
              }
          }
      }
code: public function addHeader($key, $value = null, $toLower = true)
      {
          if (is_array($key)) {
              foreach ($key as $k => $v) {
                  $this->addHeader($k, $v);
              }
          } else {
              if ($value !== null) {
                  if ($toLower === true) {
                      $key = strtolower($key);
                  }
                  if (!isset($this->_headers[$key])) {
                      $this->_headers[$key] = $value;
                  } else {
                      if (is_array($this->_headers[$key])) {
                          $this->_headers[$key][] = $value;
                      } else {
                          $this->_headers[$key] = [$this->_headers[$key], $value];
                      }
                  }
              }
          }
      }
code_tokens: public function addHeader ( $ key , $ value = null , $ toLower = true ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ v ) { $ this -> addHeader ( $ k , $ v ) ; } } else { if ( $ value !== null ) { if ( $ toLower === true ) { $ key = strtolower ( $ key ) ; } if ( ! isset ( $ this -> _headers [ $ key ] ) ) { $ this -> _headers [ $ key ] = $ value ; } else { if ( is_array ( $ this -> _headers [ $ key ] ) ) { $ this -> _headers [ $ key ] [ ] = $ value ; } else { $ this -> _headers [ $ key ] = [ $ this -> _headers [ $ key ] , $ value ] ; } } } } }
docstring: Add http header or headers
  @param mixed $key string key or key-value pairs to be added.
  @param string $value the header value when key is string.
  @param boolean $toLower convert key to lowercase
docstring_tokens: Add http header or headers