| 1 | <?php |
||
| 5 | class HttpResult |
||
| 6 | { |
||
| 7 | /** @var CurlInfo */ |
||
| 8 | protected $curlInfo; |
||
| 9 | |||
| 10 | /** @var string */ |
||
| 11 | protected $error; |
||
| 12 | |||
| 13 | /** @var string */ |
||
| 14 | protected $response; |
||
| 15 | |||
| 16 | /** @var mixed */ |
||
| 17 | protected $additionalData; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @return null|string |
||
| 21 | */ |
||
| 22 | public function getResponse() |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | public function getError() |
||
| 38 | |||
| 39 | |||
| 40 | /** |
||
| 41 | * @return CurlInfo |
||
| 42 | */ |
||
| 43 | public function getInfo() |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @return integer|null |
||
| 50 | */ |
||
| 51 | public function getHttpCode() |
||
| 55 | |||
| 56 | |||
| 57 | /** |
||
| 58 | * HttpResult constructor. |
||
| 59 | * @param $data |
||
| 60 | * @param $curlInfo |
||
| 61 | * @param $error |
||
| 62 | * @param $additionalData |
||
| 63 | */ |
||
| 64 | public function __construct($data, $curlInfo, $error, $additionalData) |
||
| 65 | { |
||
| 66 | $this->response = $data; |
||
| 67 | |||
| 68 | $this->curlInfo = new CurlInfo($curlInfo); |
||
| 69 | $this->error = $error; |
||
| 70 | $this->additionalData = $additionalData; |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @return bool |
||
| 75 | */ |
||
| 76 | public function hasError() |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @return mixed |
||
| 87 | */ |
||
| 88 | public function getAdditionalData() |
||
| 92 | |||
| 93 | } |
||
| 94 |