blob: 5ab2d14d6e25a63ef255b9d350598cf9d3a5500e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<?php
/**
* PCurl is a REST client libary for PHP.
*
* See http://github.com/purplecode/php.curl for details.
*
* This code is licensed for use, modification, and distribution
* under the terms of the MIT License (see http://en.wikipedia.org/wiki/MIT_License)
*/
namespace PurpleCode\PCurl;
class PCurlResponse {
private $body;
private $header;
public function __construct($header, $body, $httpCode) {
$this->header = $header;
$this->body = $body;
$this->httpCode = intval($httpCode);
}
public function setBody($body) {
$this->body = $body;
}
public function getBody() {
return $this->body;
}
public function setHeader($header) {
$this->header = $header;
}
public function getHeader() {
return $this->header;
}
public function setHttpCode($httpCode) {
$this->httpCode = $httpCode;
}
public function getHttpCode() {
return $this->httpCode;
}
public function assertSuccess() {
PCurlException::assert($this->getHttpCode() == 200, "Request failed (" . $this->getHttpCode() . ")", array(), $this->getHttpCode());
return $this;
}
}
|