1 | <?php |
||
16 | class Response implements ResponseInterface |
||
17 | { |
||
18 | use ConfigurableTrait; |
||
19 | |||
20 | const UNITS_TYPE_DEBIT = 0; |
||
21 | const UNITS_TYPE_REST = 1; |
||
22 | const UNITS_TYPE_LIMIT = 2; |
||
23 | |||
24 | /** |
||
25 | * Response constructor. |
||
26 | * |
||
27 | * @param array $responseAttributes |
||
28 | */ |
||
29 | 2 | public function __construct(array $responseAttributes) |
|
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $units = [null, null, null]; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $requestId; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $body; |
||
48 | |||
49 | /** |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $headers = []; |
||
53 | |||
54 | /** |
||
55 | * @return array |
||
56 | */ |
||
57 | 1 | public function getUnits() |
|
58 | { |
||
59 | 1 | return $this->units; |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * @param string $rawUnits |
||
64 | * @throws InvalidArgumentException |
||
65 | */ |
||
66 | 2 | public function setUnits($rawUnits) |
|
75 | |||
76 | /** |
||
77 | * @inheritdoc |
||
78 | */ |
||
79 | 1 | public function getRequestId() |
|
80 | { |
||
81 | 1 | return $this->requestId; |
|
82 | } |
||
83 | |||
84 | /** |
||
85 | * @inheritdoc |
||
86 | */ |
||
87 | 1 | public function getUnitsDebit() |
|
88 | { |
||
89 | 1 | return $this->getUnits()[self::UNITS_TYPE_DEBIT]; |
|
90 | } |
||
91 | |||
92 | /** |
||
93 | * @inheritdoc |
||
94 | */ |
||
95 | 1 | public function getUnitsRest() |
|
96 | { |
||
97 | 1 | return $this->getUnits()[self::UNITS_TYPE_REST]; |
|
98 | } |
||
99 | |||
100 | /** |
||
101 | * @inheritdoc |
||
102 | */ |
||
103 | 1 | public function getUnitsLimit() |
|
104 | { |
||
105 | 1 | return $this->getUnits()[self::UNITS_TYPE_LIMIT]; |
|
106 | } |
||
107 | |||
108 | /** |
||
109 | * @inheritdoc |
||
110 | */ |
||
111 | 2 | public function getBody() |
|
115 | |||
116 | /** |
||
117 | * @inheritdoc |
||
118 | */ |
||
119 | 1 | public function getHeaders() |
|
123 | } |
||
124 |