@@ -38,6 +38,12 @@ public function __construct(ContainerInterface $options){
3838 throw new HTTPClientException ('invalid CA file ' );
3939 }
4040
41+ }
42+
43+ /**
44+ * @return void
45+ */
46+ protected function initCurl (){
4147 $ this ->http = curl_init ();
4248
4349 curl_setopt_array ($ this ->http , [
@@ -86,14 +92,15 @@ protected function getResponse():HTTPResponseInterface{
8692 parse_str ($ this ->parsedURL ['query ' ] ?? '' , $ parsedquery );
8793 $ params = array_merge ($ parsedquery , $ this ->requestParams );
8894
89- $ url = $ this ->requestURL .(!empty ($ params ) ? '? ' .http_build_query ($ params ) : '' );
95+ $ url = $ this ->requestURL .(!empty ($ params ) ? '? ' .$ this -> buildQuery ($ params ) : '' );
9096
9197 $ options += [
9298 CURLOPT_URL => $ url ,
9399 CURLOPT_HTTPHEADER => $ headers ,
94100 CURLOPT_HEADERFUNCTION => [$ this , 'headerLine ' ],
95101 ];
96102
103+ $ this ->initCurl ();
97104 curl_setopt_array ($ this ->http , $ options );
98105
99106 $ response = curl_exec ($ this ->http );
@@ -115,7 +122,7 @@ protected function getResponse():HTTPResponseInterface{
115122 *
116123 * @link http://php.net/manual/function.curl-setopt.php CURLOPT_HEADERFUNCTION
117124 */
118- protected function headerLine (/** @noinspection PhpUnusedParameterInspection */ $ curl , $ header_line ){
125+ protected function headerLine ($ curl , $ header_line ){
119126 $ header = explode (': ' , $ header_line , 2 );
120127
121128 if (count ($ header ) === 2 ){
0 commit comments