5
5
namespace WrkFlow \ApiSdkBuilder \Endpoints ;
6
6
7
7
use Closure ;
8
- use JustSteveKing \UriBuilder \Uri ;
9
8
use Psr \Http \Message \ResponseInterface ;
10
9
use Psr \Http \Message \StreamInterface ;
10
+ use Psr \Http \Message \UriInterface ;
11
11
use Throwable ;
12
12
use WrkFlow \ApiSdkBuilder \Contracts \ApiFactoryContract ;
13
13
use WrkFlow \ApiSdkBuilder \Entities \EndpointDIEntity ;
@@ -85,14 +85,14 @@ final protected function shouldIgnoreLoggersOnException(): ?Closure
85
85
*/
86
86
abstract protected function basePath (): string ;
87
87
88
- final protected function uri (string $ appendPath = '' ): Uri
88
+ final protected function uri (string $ appendPath = '' ): UriInterface
89
89
{
90
90
$ uri = $ this ->di ->api ()
91
91
->uri ();
92
92
$ basePath = $ this ->appendSlashIfNeeded ($ this ->basePath ());
93
93
$ appendPath = $ this ->appendSlashIfNeeded ($ appendPath );
94
94
95
- return $ uri ->addPath ($ uri ->path () . $ basePath . $ appendPath );
95
+ return $ uri ->withPath ($ uri ->getPath () . $ basePath . $ appendPath );
96
96
}
97
97
98
98
@@ -106,13 +106,13 @@ final protected function uri(string $appendPath = ''): Uri
106
106
*/
107
107
final protected function sendGet (
108
108
string $ responseClass ,
109
- Uri $ uri ,
109
+ UriInterface $ uri ,
110
110
array $ headers = [],
111
111
?int $ expectedResponseStatusCode = null ,
112
112
): AbstractResponse {
113
113
$ request = $ this ->factory ()
114
114
->request ()
115
- ->createRequest ('GET ' , $ uri -> toString () );
115
+ ->createRequest ('GET ' , ( string ) $ uri );
116
116
117
117
return $ this
118
118
->di
@@ -141,14 +141,14 @@ final protected function sendGet(
141
141
*/
142
142
final protected function sendPost (
143
143
string $ responseClass ,
144
- Uri $ uri ,
144
+ UriInterface $ uri ,
145
145
OptionsInterface |StreamInterface |string $ body = null ,
146
146
array $ headers = [],
147
147
?int $ expectedResponseStatusCode = null ,
148
148
): AbstractResponse {
149
149
$ request = $ this ->factory ()
150
150
->request ()
151
- ->createRequest ('POST ' , $ uri -> toString () );
151
+ ->createRequest ('POST ' , ( string ) $ uri );
152
152
153
153
return $ this ->di ->sendRequestAction ()
154
154
->execute (
@@ -176,15 +176,15 @@ final protected function sendPost(
176
176
*/
177
177
final protected function sendPut (
178
178
string $ responseClass ,
179
- Uri $ uri ,
179
+ UriInterface $ uri ,
180
180
OptionsInterface |StreamInterface |string $ body = null ,
181
181
array $ headers = [],
182
182
?int $ expectedResponseStatusCode = null ,
183
183
Closure $ shouldIgnoreLoggersOnError = null ,
184
184
): AbstractResponse {
185
185
$ request = $ this ->factory ()
186
186
->request ()
187
- ->createRequest ('PUT ' , $ uri -> toString () );
187
+ ->createRequest ('PUT ' , ( string ) $ uri );
188
188
189
189
return $ this
190
190
->di
@@ -214,14 +214,14 @@ final protected function sendPut(
214
214
*/
215
215
final protected function sendDelete (
216
216
string $ responseClass ,
217
- Uri $ uri ,
217
+ UriInterface $ uri ,
218
218
OptionsInterface |StreamInterface |string $ body = null ,
219
219
array $ headers = [],
220
220
?int $ expectedResponseStatusCode = null ,
221
221
): AbstractResponse {
222
222
$ request = $ this ->factory ()
223
223
->request ()
224
- ->createRequest ('DELETE ' , $ uri -> toString () );
224
+ ->createRequest ('DELETE ' , ( string ) $ uri );
225
225
226
226
return $ this
227
227
->di
@@ -254,7 +254,7 @@ final protected function sendDelete(
254
254
final protected function sendFake (
255
255
ResponseInterface $ response ,
256
256
string $ responseClass ,
257
- Uri $ uri ,
257
+ UriInterface $ uri ,
258
258
OptionsInterface |StreamInterface |string $ body = null ,
259
259
array $ headers = [],
260
260
?int $ expectedResponseStatusCode = null ,
@@ -269,7 +269,7 @@ final protected function sendFake(
269
269
request: $ this
270
270
->factory ()
271
271
->request ()
272
- ->createRequest ('FAKE ' , $ uri -> toString () ),
272
+ ->createRequest ('FAKE ' , ( string ) $ uri ),
273
273
responseClass: $ responseClass ,
274
274
body: $ body ,
275
275
headers: $ headers ,
0 commit comments