11<?php
22
3+ declare (strict_types=1 );
4+
35namespace ChromaX \BasicHttpClient ;
46
57use ChromaX \BasicHttpClient \Request \RequestInterface ;
2123class BasicHttpClient implements HttpClientInterface
2224{
2325
24- /**
25- * @var RequestInterface
26- */
27- private $ request ;
26+ private RequestInterface $ request ;
2827
29- /**
30- * BasicHttpClient constructor.
31- *
32- * @param string $endpoint
33- */
3428 public function __construct (string $ endpoint )
3529 {
3630 $ url = new Url ($ endpoint );
@@ -45,21 +39,12 @@ public function __construct(string $endpoint)
4539 ->setUrl (new Url ($ endpoint ));
4640 }
4741
48- /**
49- * @return RequestInterface
50- */
5142 public function getRequest (): RequestInterface
5243 {
5344 return $ this ->request ;
5445 }
5546
56- /**
57- * @param mixed[] $queryParameters
58- * @return ResponseInterface
59- * @throws NetworkException
60- * @throws ConnectionTimeoutException
61- */
62- public function get (array $ queryParameters = array ()): ResponseInterface
47+ public function get (array $ queryParameters = []): ResponseInterface
6348 {
6449 $ this ->request
6550 ->setMethod (RequestInterface::REQUEST_METHOD_GET )
@@ -69,13 +54,7 @@ public function get(array $queryParameters = array()): ResponseInterface
6954 return $ this ->request ->getResponse ();
7055 }
7156
72- /**
73- * @param mixed[] $queryParameters
74- * @return ResponseInterface
75- * @throws NetworkException
76- * @throws ConnectionTimeoutException
77- */
78- public function head (array $ queryParameters = array ()): ResponseInterface
57+ public function head (array $ queryParameters = []): ResponseInterface
7958 {
8059 $ this ->request
8160 ->setMethod (RequestInterface::REQUEST_METHOD_HEAD )
@@ -85,13 +64,7 @@ public function head(array $queryParameters = array()): ResponseInterface
8564 return $ this ->request ->getResponse ();
8665 }
8766
88- /**
89- * @param array $postData
90- * @return ResponseInterface
91- * @throws NetworkException
92- * @throws ConnectionTimeoutException
93- */
94- public function post (array $ postData = array ()): ResponseInterface
67+ public function post (array $ postData = []): ResponseInterface
9568 {
9669 $ body = new Body ();
9770 $ body ->setBodyTextFromArray ($ postData );
@@ -104,13 +77,7 @@ public function post(array $postData = array()): ResponseInterface
10477 return $ this ->request ->getResponse ();
10578 }
10679
107- /**
108- * @param array $putData
109- * @return ResponseInterface
110- * @throws NetworkException
111- * @throws ConnectionTimeoutException
112- */
113- public function put (array $ putData = array ()): ResponseInterface
80+ public function put (array $ putData = []): ResponseInterface
11481 {
11582 $ body = new Body ();
11683 $ body ->setBodyTextFromArray ($ putData );
@@ -123,13 +90,7 @@ public function put(array $putData = array()): ResponseInterface
12390 return $ this ->request ->getResponse ();
12491 }
12592
126- /**
127- * @param array $patchData
128- * @return ResponseInterface
129- * @throws NetworkException
130- * @throws ConnectionTimeoutException
131- */
132- public function patch (array $ patchData = array ()): ResponseInterface
93+ public function patch (array $ patchData = []): ResponseInterface
13394 {
13495 $ body = new Body ();
13596 $ body ->setBodyTextFromArray ($ patchData );
@@ -142,13 +103,7 @@ public function patch(array $patchData = array()): ResponseInterface
142103 return $ this ->request ->getResponse ();
143104 }
144105
145- /**
146- * @param mixed[] $queryParameters
147- * @return ResponseInterface
148- * @throws NetworkException
149- * @throws ConnectionTimeoutException
150- */
151- public function delete (array $ queryParameters = array ()): ResponseInterface
106+ public function delete (array $ queryParameters = []): ResponseInterface
152107 {
153108 $ this ->request
154109 ->setMethod (RequestInterface::REQUEST_METHOD_DELETE )
0 commit comments