6use Psr\Http\Message\StreamInterface;
10 private $statusCode = 200;
13 private $reasonPhrase =
'OK';
16 private $protocolVersion =
'1.1';
22 private $headerContainer;
25 private $cookies = [];
37 return $this->statusCode;
41 return $this->reasonPhrase;
44 public function setStatus( $code, $reasonPhrase =
'' ) {
45 $this->statusCode = $code;
46 if ( $reasonPhrase ===
'' ) {
47 $reasonPhrase = HttpStatus::getMessage( $code ) ??
'';
49 $this->reasonPhrase = $reasonPhrase;
53 return $this->protocolVersion;
57 return $this->headerContainer->getHeaders();
61 return $this->headerContainer->hasHeader( $name );
65 return $this->headerContainer->getHeader( $name );
69 return $this->headerContainer->getHeaderLine( $name );
77 $this->protocolVersion = $version;
81 $this->headerContainer->setHeader( $name, $value );
85 $this->headerContainer->addHeader( $name, $value );
89 $this->headerContainer->removeHeader( $name );
92 public function setBody( StreamInterface $body ) {
97 return $this->headerContainer->getRawHeaderLines();
100 public function setCookie( $name, $value, $expire = 0, $options = [] ) {
105 'options' => $options
110 return $this->cookies;