Bluz\Response\Response::setHeaders PHP Method

setHeaders() public method

The array keys MUST be a string. The array values must be either a string or an array of strings.
public setHeaders ( array $headers ) : void
$headers array Headers to set.
return void
    public function setHeaders(array $headers)
    {
        $this->headers = $headers;
    }

Usage Example

Example #1
0
 /**
  * @covers \Bluz\Response\Response::setHeaders
  * @covers \Bluz\Response\Response::addHeaders
  * @covers \Bluz\Response\Response::getHeaders
  */
 public function testAddHeaders()
 {
     $this->response->setHeaders(['foo' => ['bar']]);
     $this->response->addHeaders(['foo' => ['baz'], 'baz' => ['qux']]);
     $this->assertEquals(2, sizeof($this->response->getHeaders()));
     $this->assertArrayHasKeyAndSize($this->response->getHeaders(), 'foo', 2);
 }