1
1
<?php
2
2
3
+ declare (strict_types=1 );
4
+
3
5
namespace ChromaX \BasicHttpClient ;
4
6
5
7
use ChromaX \BasicHttpClient \Request \RequestInterface ;
21
23
class BasicHttpClient implements HttpClientInterface
22
24
{
23
25
24
- /**
25
- * @var RequestInterface
26
- */
27
- private $ request ;
26
+ private RequestInterface $ request ;
28
27
29
- /**
30
- * BasicHttpClient constructor.
31
- *
32
- * @param string $endpoint
33
- */
34
28
public function __construct (string $ endpoint )
35
29
{
36
30
$ url = new Url ($ endpoint );
@@ -45,21 +39,12 @@ public function __construct(string $endpoint)
45
39
->setUrl (new Url ($ endpoint ));
46
40
}
47
41
48
- /**
49
- * @return RequestInterface
50
- */
51
42
public function getRequest (): RequestInterface
52
43
{
53
44
return $ this ->request ;
54
45
}
55
46
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
63
48
{
64
49
$ this ->request
65
50
->setMethod (RequestInterface::REQUEST_METHOD_GET )
@@ -69,13 +54,7 @@ public function get(array $queryParameters = array()): ResponseInterface
69
54
return $ this ->request ->getResponse ();
70
55
}
71
56
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
79
58
{
80
59
$ this ->request
81
60
->setMethod (RequestInterface::REQUEST_METHOD_HEAD )
@@ -85,13 +64,7 @@ public function head(array $queryParameters = array()): ResponseInterface
85
64
return $ this ->request ->getResponse ();
86
65
}
87
66
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
95
68
{
96
69
$ body = new Body ();
97
70
$ body ->setBodyTextFromArray ($ postData );
@@ -104,13 +77,7 @@ public function post(array $postData = array()): ResponseInterface
104
77
return $ this ->request ->getResponse ();
105
78
}
106
79
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
114
81
{
115
82
$ body = new Body ();
116
83
$ body ->setBodyTextFromArray ($ putData );
@@ -123,13 +90,7 @@ public function put(array $putData = array()): ResponseInterface
123
90
return $ this ->request ->getResponse ();
124
91
}
125
92
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
133
94
{
134
95
$ body = new Body ();
135
96
$ body ->setBodyTextFromArray ($ patchData );
@@ -142,13 +103,7 @@ public function patch(array $patchData = array()): ResponseInterface
142
103
return $ this ->request ->getResponse ();
143
104
}
144
105
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
152
107
{
153
108
$ this ->request
154
109
->setMethod (RequestInterface::REQUEST_METHOD_DELETE )
0 commit comments