| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace ThurData\Servers\KerioEmail\Core\Api\AbstractApi\Curl;
- /**
- * Description of Respons
- *
- * @author Rafał Ossowski <rafal.os@thurdata.com>
- */
- class Response
- {
- protected $body;
- protected $request;
- protected $header;
- protected $code;
- public function setRequest($request)
- {
- $this->request = $request;
- return $this;
- }
- public function setHeader($header)
- {
- $this->header = $header;
- return $this;
- }
- public function setBody($body)
- {
- $this->body = $body;
- return $this;
- }
- public function setCode($code)
- {
- $this->code = $code;
- return $this;
- }
- /**
- * @param bool $isJson
- * @return string|\stdClass
- */
- public function getBody($isJson = true)
- {
- if ($isJson)
- {
- return json_decode($this->body);
- }
- return $this->body;
- }
- /**
- * @return string
- */
- public function getRequest()
- {
- return $this->request;
- }
- /**
- * @return string
- */
- public function getHeader()
- {
- return $this->header;
- }
- /**
- * @return int
- */
- public function getCode()
- {
- return $this->code;
- }
- /**
- * @return bool
- */
- public function isSuccess()
- {
- return (bool) ($this->code >= 200 && $this->code < 300);
- }
- }
|