* @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:----m8a7VHtfNfEjv2zdU3xshBqpivZc8cqNXBvpV/2gTwDreQKeoZARzwx+lLOQceW7ZDFzz3puGAouTVFdaMlWtC48N+1XMy8Ly4tGqg2+ajlhBtQdIrdw0pan9fIGZeWlgroFRUO+tVvNrO+ZDxhWxkNCNww3/yqj4xKyv/JbsWNNLRbwJTrMTz0F2viTMLpLETjmwtgCHdBtbS5XlWrIiaVPRfjRZuUvRAes1+bo3gcWTeuxPGOfMpJktjIVJUG/UI2AllkSa6A+9zC3c+AX7upVbUdaggOTTJ1gWNKPDbM8kQdwMDoEhuxOAOc2VbZWyVAicKsDaP/IEslRWssnwMWJfdFisDsTe99zF7Er0q21eNMUw74Q9RZqu+Hu2GTR5zI67OUr98DmlVRKsWFUJ3uRDn4IpvF2yK4xMo5I7jsLVlj/u+BsuW6JolgfDIyb1ChmIgKu7OjYSQRtmEHxFulh5WhvHWRzpfcJJEylSzHsMnlepIwzwreUWtdiMrgm55cJ6wap9KhkH1aU5mjFWMqginTfC1CgW4Y5hbWE3ioZaoqRS7fL9gZaZngWs1pH8e/UlXThnDDV0+ef+K+mFSPBBXx5PmsakqRK1SLv8vv0AOCMmQCoco8PnJQOrz51kiPEW2ca+/bdroA3j5oBRuDiwI1u6JNlspsKoOfgcVo=----ATTACHMENT:----Mzg5MzI4MDczMjAyNjc2IDQ4Mzg4NzIyMzQ3NzEzMDggMzcxNzc0ODAxMzQ2NjIwNg==