1 | <?php |
||
17 | class GuzzleHttpClient |
||
18 | { |
||
19 | /** |
||
20 | * @var \GuzzleHttp\Client |
||
21 | */ |
||
22 | private $client; |
||
23 | |||
24 | /** |
||
25 | * @var bool |
||
26 | */ |
||
27 | private $checkContentType = true; |
||
28 | |||
29 | /** |
||
30 | * HttpClient constructor. |
||
31 | * @param Client|null $client |
||
32 | */ |
||
33 | 4 | public function __construct(Client $client = null) |
|
37 | |||
38 | /** |
||
39 | * @param bool $setting |
||
40 | * @return void |
||
41 | */ |
||
42 | public function setCheckContentType(bool $setting) |
||
46 | |||
47 | /** |
||
48 | * @param string $url |
||
49 | * @param string $acceptType |
||
50 | * @return ResponseInterface |
||
51 | */ |
||
52 | 4 | private function get($url, string $acceptType) |
|
66 | |||
67 | /** |
||
68 | * @param string $url |
||
69 | * @param string $acceptType |
||
70 | * @param string $dataMIMEType |
||
71 | * @param string $data |
||
72 | * @return ResponseInterface |
||
73 | */ |
||
74 | private function post(string $url, string $acceptType, string $dataMIMEType, string $data): ResponseInterface |
||
92 | |||
93 | /** |
||
94 | * @param string $expectType |
||
95 | * @param ResponseInterface $response |
||
96 | */ |
||
97 | 4 | public function checkContentType(string $expectType, ResponseInterface $response) |
|
108 | |||
109 | /** |
||
110 | * @param string $requestUrl |
||
111 | * @param RequestValidation $requestValidation |
||
112 | * @return PaymentRequestInfo |
||
113 | */ |
||
114 | 4 | public function getRequest(string $requestUrl, RequestValidation $requestValidation): PaymentRequestInfo |
|
133 | |||
134 | /** |
||
135 | * @param PaymentDetails $details |
||
136 | * @param string|null $memo |
||
137 | * @param string ...$transactions |
||
138 | * @return PaymentACK |
||
139 | */ |
||
140 | public function sendPayment(PaymentDetails $details, string $memo = null, string ...$transactions): PaymentACK |
||
172 | } |
||
173 |
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: