1 | <?php |
||
14 | class Response extends GuzzleResponse |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $forceArrayKeys = []; |
||
20 | |||
21 | /** |
||
22 | * @param $forceArrayKeys |
||
23 | * |
||
24 | * @return $this |
||
25 | */ |
||
26 | public function setForceArrayKeys($forceArrayKeys) |
||
32 | |||
33 | /** |
||
34 | * @return array |
||
35 | */ |
||
36 | public function getForceArrayKeys() |
||
40 | |||
41 | /** |
||
42 | * @return string |
||
43 | */ |
||
44 | public function getBodyContents() |
||
52 | |||
53 | /** |
||
54 | * @param ResponseInterface $response |
||
55 | * @author kaylv <[email protected]> |
||
56 | * @return static |
||
57 | */ |
||
58 | public static function buildFromPsrResponse(ResponseInterface $response) |
||
68 | |||
69 | /** |
||
70 | * Build to json. |
||
71 | * |
||
72 | * @return string |
||
73 | * |
||
74 | * @throws Exception |
||
75 | */ |
||
76 | public function toJson() |
||
80 | |||
81 | /** |
||
82 | * Build to array. |
||
83 | * |
||
84 | * @return array |
||
85 | * |
||
86 | * @throws Exception |
||
87 | */ |
||
88 | public function toArray() |
||
94 | |||
95 | /** |
||
96 | * Get collection data. |
||
97 | * @author kaylv <[email protected]> |
||
98 | * @return Collection |
||
99 | */ |
||
100 | public function toCollection() |
||
104 | |||
105 | /** |
||
106 | * @return object |
||
107 | * |
||
108 | * @throws Exception |
||
109 | */ |
||
110 | public function toObject() |
||
114 | |||
115 | /** |
||
116 | * @return bool|string |
||
117 | */ |
||
118 | public function __toString() |
||
122 | |||
123 | /** |
||
124 | * @param string $content |
||
125 | * |
||
126 | * @return string |
||
127 | */ |
||
128 | protected function removeControlCharacters(string $content) |
||
132 | } |
||
133 |