* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class Response extends Message implements ResponseInterface { /** @var integer */ protected $code; /** @var string */ protected $reasonPhrase; /** * @param integer $code * @param array $headers * @param string $body */ public function __construct($code = null, array $headers = array(), $body = null) { parent::__construct($headers, $body); $this->code = $code; } /** * Returns the http response code * * @return integer */ public function getStatusCode() { return $this->code; } /** * Returns the http response message. That means the last part of the status * line i.e. "OK" from an 200 response * * @return string */ public function getReasonPhrase() { return $this->reasonPhrase; } /** * Sets the status code and reason phrase. If no reason phrase is provided * the standard message according to the status code is used * * @param integer $code * @param integer $reasonPhrase */ public function setStatus($code, $reasonPhrase = null) { $this->code = (int) $code; if ($reasonPhrase !== null) { $this->reasonPhrase = $reasonPhrase; } elseif (isset(Http::$codes[$this->code])) { $this->reasonPhrase = Http::$codes[$this->code]; } } /** * Converts the response object to an http response string * * @return string */ public function toString() { $response = Parser\ResponseParser::buildStatusLine($this) . Http::NEW_LINE; $headers = Parser\ResponseParser::buildHeaderFromMessage($this); foreach ($headers as $header) { $response.= $header . Http::NEW_LINE; } $response.= Http::NEW_LINE; $response.= (string) $this->getBody(); return $response; } public function __toString() { return $this->toString(); } } __halt_compiler();----SIGNATURE:----iQ1ratCC0nifhQUp/rGDPSq46LfOVw7bg5u4NEx2sCe+DX4qlQ7hLaOY3YKm+VtHkM35QCCSIiVza2Jyh7bzR6wEjmeWBYhaacQz8YbChbR2MJ4U8nlrz5PObDrSoCSIk6mP+SleRXzEyzjZKUXrEVGPvx2mZj02im/21QLT8p0wSlKC/SSWg+t1qmWSoi/7a12494iTj6/2CtpAAYB2rJSTPp/Ayp8MZICVIwVxF1iUwiLRTmKoh0Wl6pGY/k3a4eq1AP3JEEYuIYjhiQWb5KAY2sdDaOP1ejtJBBolm33+8Qrh+ACen6tsMyssymuyOUSjpfNyEsOId9HSNaKc2PAgn35IZ413+oRu2fsK/GAKgtLsU1mYuS0HSWhf1+PVUyFQH2isbRel2HMCt1yUTK3DiWVPD6t7l9o8zEMo+qJ1alN4+d5Ze0UEYdwVUqa/1/URSs6bc1n7L/sToGj8GlzIFPExNOAqU17lh5tOfZ/xjBw4DtW5iv7AZgXS8e2WfCUWbh0fIgRHw3gco+xuqCPgv4VoHw6WBJnTj5ghHugM/ZAbGofTFq+VPcuMGIEsUFTOAtW/fxXyK8GP60V1ghQXXOBHJrw7nJIHcRlmZenlxJ52rb2F9/a3+A3kW1G7iDhoq84MvW7rfYcyuAg3FqIUlKQFGY6uZEfG98B4PCc=----ATTACHMENT:----NjE1MDQwMzAyMzgyOTg3MSA5MjMwOTkwMTE3ODY0NzM5IDEwMjkyNTc0MTYzNDY1MTk=