$code) || (599 < $code)) { throw new \Qii\Exceptions\Response('Invalid HTTP response code'); } $this->_responseCode = $code; return $this; } /** * Retrieve HTTP response code * * @return int */ public function getResponseCode() { return $this->_responseCode; } /** * Send all headers * * Sends any headers specified. * If an {@link setResponseCode() HTTP response code} * has been specified, it is sent with the first header. * * @return Yaf_Response_Http */ protected function sendHeaders() { $httpCodeSent = false; foreach ($this->_headers as $header) { if (!$httpCodeSent && $this->_responseCode) { header( $header['name'] . ': ' . $header['value'], $header['replace'], $this->_responseCode ); $httpCodeSent = true; } else { header( $header['name'] . ': ' . $header['value'], $header['replace'] ); } } return $this; } /** * Set redirect URL * * Sets Location header. Forces replacement of any prior redirects. * * @param string $url * @return Yaf_Response_Abstract */ public function setRedirect($url) { $this->setHeader('Location', $url, true) ->setResponseCode(302); return $this; } }