public function withHeader($header, $value = null) { if ($header instanceof Header) { $this->headers[$header->getHeader()] = $header->getValue(); } else { $this->headers[$header] = $value; } return $this; }