1 | <?php |
||
18 | class GuzzleHttpClient |
||
19 | { |
||
20 | /** |
||
21 | * @var \GuzzleHttp\Client |
||
22 | */ |
||
23 | private $client; |
||
24 | |||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | private $checkContentType = true; |
||
29 | |||
30 | /** |
||
31 | * HttpClient constructor. |
||
32 | * @param Client|null $client |
||
33 | */ |
||
34 | 6 | public function __construct(Client $client = null) |
|
38 | |||
39 | /** |
||
40 | * @param bool $setting |
||
41 | * @return void |
||
42 | */ |
||
43 | public function setCheckContentType(bool $setting) |
||
47 | |||
48 | /** |
||
49 | * @param string $url |
||
50 | * @param string $acceptType |
||
51 | * @return ResponseInterface |
||
52 | */ |
||
53 | 6 | private function get($url, string $acceptType) |
|
67 | |||
68 | /** |
||
69 | * @param string $url |
||
70 | * @param string $acceptType |
||
71 | * @param string $dataMIMEType |
||
72 | * @param string $data |
||
73 | * @return ResponseInterface |
||
74 | */ |
||
75 | private function post(string $url, string $acceptType, string $dataMIMEType, string $data): ResponseInterface |
||
93 | |||
94 | /** |
||
95 | * @param string $expectType |
||
96 | * @param ResponseInterface $response |
||
97 | */ |
||
98 | 6 | public function checkContentType(string $expectType, ResponseInterface $response) |
|
109 | |||
110 | /** |
||
111 | * @param string $requestUrl |
||
112 | * @param RequestValidation $requestValidation |
||
113 | * @return PaymentRequestInfo |
||
114 | */ |
||
115 | 6 | public function getRequest(string $requestUrl, RequestValidation $requestValidation): PaymentRequestInfo |
|
134 | |||
135 | /** |
||
136 | * @param PaymentDetails $details |
||
137 | * @param string|null $memo |
||
138 | * @param string ...$transactions |
||
139 | * @return PaymentACK |
||
140 | */ |
||
141 | public function sendPayment(PaymentDetails $details, string $memo = null, string ...$transactions): PaymentACK |
||
173 | } |
||
174 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: