示例#1
0
 /**
  * @param HttpResponseInterface $response
  * @return $this
  */
 protected function applyHttpHeaders(HttpResponseInterface $response)
 {
     if (!empty($this->httpResponseCode)) {
         $response->setHttpResponseCode($this->httpResponseCode);
     }
     if ($this->statusHeaderCode) {
         $response->setStatusHeader($this->statusHeaderCode, $this->statusHeaderVersion, $this->statusHeaderPhrase);
     }
     if (!empty($this->headers)) {
         foreach ($this->headers as $headerData) {
             $response->setHeader($headerData['name'], $headerData['value'], $headerData['replace']);
         }
     }
     return $this;
 }