1
1
<?php
2
2
3
+ declare (strict_types=1 );
4
+
3
5
namespace ChromaX \JsonHttpClient ;
4
6
5
7
use ChromaX \BasicHttpClient \HttpClientInterface ;
23
25
class JsonHttpClient implements HttpClientInterface
24
26
{
25
27
26
- /**
27
- * @var RequestInterface
28
- */
29
- private $ request ;
28
+ private RequestInterface $ request ;
30
29
31
- /**
32
- * BasicHttpClient constructor.
33
- *
34
- * @param string $endpoint
35
- */
36
- public function __construct ($ endpoint )
30
+ public function __construct (string $ endpoint )
37
31
{
38
32
$ url = new Url ($ endpoint );
39
33
$ transport = new HttpTransport ();
@@ -51,21 +45,15 @@ public function __construct($endpoint)
51
45
->setUrl ($ url );
52
46
}
53
47
54
- /**
55
- * @return RequestInterface
56
- */
57
48
public function getRequest (): RequestInterface
58
49
{
59
50
return $ this ->request ;
60
51
}
61
52
62
53
/**
63
54
* @param string[] $queryParameters
64
- * @return ResponseInterface
65
- * @throws NetworkException
66
- * @throws ConnectionTimeoutException
67
55
*/
68
- public function get (array $ queryParameters = array () ): ResponseInterface
56
+ public function get (array $ queryParameters = [] ): ResponseInterface
69
57
{
70
58
$ this ->request
71
59
->setMethod (RequestInterface::REQUEST_METHOD_GET )
@@ -77,11 +65,8 @@ public function get(array $queryParameters = array()): ResponseInterface
77
65
78
66
/**
79
67
* @param string[] $queryParameters
80
- * @return ResponseInterface
81
- * @throws NetworkException
82
- * @throws ConnectionTimeoutException
83
68
*/
84
- public function head (array $ queryParameters = array () ): ResponseInterface
69
+ public function head (array $ queryParameters = [] ): ResponseInterface
85
70
{
86
71
$ this ->request
87
72
->setMethod (RequestInterface::REQUEST_METHOD_HEAD )
@@ -91,13 +76,7 @@ public function head(array $queryParameters = array()): ResponseInterface
91
76
return $ this ->request ->getResponse ();
92
77
}
93
78
94
- /**
95
- * @param array $postData
96
- * @return ResponseInterface
97
- * @throws NetworkException
98
- * @throws ConnectionTimeoutException
99
- */
100
- public function post (array $ postData = array ()): ResponseInterface
79
+ public function post (array $ postData = []): ResponseInterface
101
80
{
102
81
$ this ->request
103
82
->getMessage ()
@@ -108,13 +87,7 @@ public function post(array $postData = array()): ResponseInterface
108
87
return $ this ->request ->getResponse ();
109
88
}
110
89
111
- /**
112
- * @param array $putData
113
- * @return ResponseInterface
114
- * @throws NetworkException
115
- * @throws ConnectionTimeoutException
116
- */
117
- public function put (array $ putData = array ()): ResponseInterface
90
+ public function put (array $ putData = []): ResponseInterface
118
91
{
119
92
$ this ->request
120
93
->getMessage ()
@@ -125,13 +98,7 @@ public function put(array $putData = array()): ResponseInterface
125
98
return $ this ->request ->getResponse ();
126
99
}
127
100
128
- /**
129
- * @param array $patchData
130
- * @return ResponseInterface
131
- * @throws NetworkException
132
- * @throws ConnectionTimeoutException
133
- */
134
- public function patch (array $ patchData = array ()): ResponseInterface
101
+ public function patch (array $ patchData = []): ResponseInterface
135
102
{
136
103
$ this ->request
137
104
->getMessage ()
@@ -142,13 +109,7 @@ public function patch(array $patchData = array()): ResponseInterface
142
109
return $ this ->request ->getResponse ();
143
110
}
144
111
145
- /**
146
- * @param string[] $queryParameters
147
- * @return ResponseInterface
148
- * @throws NetworkException
149
- * @throws ConnectionTimeoutException
150
- */
151
- public function delete (array $ queryParameters = array ()): ResponseInterface
112
+ public function delete (array $ queryParameters = []): ResponseInterface
152
113
{
153
114
$ this ->request
154
115
->setMethod (RequestInterface::REQUEST_METHOD_DELETE )
0 commit comments