Skip to content

Commit 9f14a20

Browse files
h4kunapionl
authored andcommitted
feat(Vendor): remove juststeveking/uri-builder, add dependency on UriInteface
1 parent 87e405b commit 9f14a20

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"require": {
1414
"php": ">=8.1",
1515
"guzzlehttp/psr7": "^2.5",
16-
"juststeveking/uri-builder": "^2.0",
1716
"php-http/discovery": "^1.14",
1817
"psr/http-client": "^1.0.1",
1918
"psr/http-message": "^1.0.1 || ^2.0",

src/AbstractApi.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace WrkFlow\ApiSdkBuilder;
66

77
use Closure;
8-
use JustSteveKing\UriBuilder\Uri;
98
use Psr\Http\Message\ResponseInterface;
9+
use Psr\Http\Message\UriInterface;
1010
use WrkFlow\ApiSdkBuilder\Contracts\ApiFactoryContract;
1111
use WrkFlow\ApiSdkBuilder\Environments\AbstractEnvironment;
1212
use WrkFlow\ApiSdkBuilder\Exceptions\BadRequestException;
@@ -50,7 +50,7 @@ final public function factory(): ApiFactoryContract
5050
return $this->factory;
5151
}
5252

53-
final public function uri(): Uri
53+
final public function uri(): UriInterface
5454
{
5555
return $this->environment->uri();
5656
}

src/Endpoints/AbstractEndpoint.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace WrkFlow\ApiSdkBuilder\Endpoints;
66

77
use Closure;
8-
use JustSteveKing\UriBuilder\Uri;
98
use Psr\Http\Message\ResponseInterface;
109
use Psr\Http\Message\StreamInterface;
10+
use Psr\Http\Message\UriInterface;
1111
use Throwable;
1212
use WrkFlow\ApiSdkBuilder\Contracts\ApiFactoryContract;
1313
use WrkFlow\ApiSdkBuilder\Entities\EndpointDIEntity;
@@ -85,14 +85,14 @@ final protected function shouldIgnoreLoggersOnException(): ?Closure
8585
*/
8686
abstract protected function basePath(): string;
8787

88-
final protected function uri(string $appendPath = ''): Uri
88+
final protected function uri(string $appendPath = ''): UriInterface
8989
{
9090
$uri = $this->di->api()
9191
->uri();
9292
$basePath = $this->appendSlashIfNeeded($this->basePath());
9393
$appendPath = $this->appendSlashIfNeeded($appendPath);
9494

95-
return $uri->addPath($uri->path() . $basePath . $appendPath);
95+
return $uri->withPath($uri->getPath() . $basePath . $appendPath);
9696
}
9797

9898

@@ -106,13 +106,13 @@ final protected function uri(string $appendPath = ''): Uri
106106
*/
107107
final protected function sendGet(
108108
string $responseClass,
109-
Uri $uri,
109+
UriInterface $uri,
110110
array $headers = [],
111111
?int $expectedResponseStatusCode = null,
112112
): AbstractResponse {
113113
$request = $this->factory()
114114
->request()
115-
->createRequest('GET', $uri->toString());
115+
->createRequest('GET', (string) $uri);
116116

117117
return $this
118118
->di
@@ -141,14 +141,14 @@ final protected function sendGet(
141141
*/
142142
final protected function sendPost(
143143
string $responseClass,
144-
Uri $uri,
144+
UriInterface $uri,
145145
OptionsInterface|StreamInterface|string $body = null,
146146
array $headers = [],
147147
?int $expectedResponseStatusCode = null,
148148
): AbstractResponse {
149149
$request = $this->factory()
150150
->request()
151-
->createRequest('POST', $uri->toString());
151+
->createRequest('POST', (string) $uri);
152152

153153
return $this->di->sendRequestAction()
154154
->execute(
@@ -176,15 +176,15 @@ final protected function sendPost(
176176
*/
177177
final protected function sendPut(
178178
string $responseClass,
179-
Uri $uri,
179+
UriInterface $uri,
180180
OptionsInterface|StreamInterface|string $body = null,
181181
array $headers = [],
182182
?int $expectedResponseStatusCode = null,
183183
Closure $shouldIgnoreLoggersOnError = null,
184184
): AbstractResponse {
185185
$request = $this->factory()
186186
->request()
187-
->createRequest('PUT', $uri->toString());
187+
->createRequest('PUT', (string) $uri);
188188

189189
return $this
190190
->di
@@ -214,14 +214,14 @@ final protected function sendPut(
214214
*/
215215
final protected function sendDelete(
216216
string $responseClass,
217-
Uri $uri,
217+
UriInterface $uri,
218218
OptionsInterface|StreamInterface|string $body = null,
219219
array $headers = [],
220220
?int $expectedResponseStatusCode = null,
221221
): AbstractResponse {
222222
$request = $this->factory()
223223
->request()
224-
->createRequest('DELETE', $uri->toString());
224+
->createRequest('DELETE', (string) $uri);
225225

226226
return $this
227227
->di
@@ -254,7 +254,7 @@ final protected function sendDelete(
254254
final protected function sendFake(
255255
ResponseInterface $response,
256256
string $responseClass,
257-
Uri $uri,
257+
UriInterface $uri,
258258
OptionsInterface|StreamInterface|string $body = null,
259259
array $headers = [],
260260
?int $expectedResponseStatusCode = null,
@@ -269,7 +269,7 @@ final protected function sendFake(
269269
request: $this
270270
->factory()
271271
->request()
272-
->createRequest('FAKE', $uri->toString()),
272+
->createRequest('FAKE', (string) $uri),
273273
responseClass: $responseClass,
274274
body: $body,
275275
headers: $headers,

src/Environments/AbstractEnvironment.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace WrkFlow\ApiSdkBuilder\Environments;
66

7-
use JustSteveKing\UriBuilder\Uri;
7+
use Psr\Http\Message\UriInterface;
88
use WrkFlow\ApiSdkBuilder\Interfaces\HeadersInterface;
99

1010
abstract class AbstractEnvironment implements HeadersInterface
@@ -17,7 +17,7 @@ public function __construct(
1717
) {
1818
}
1919

20-
abstract public function uri(): Uri;
20+
abstract public function uri(): UriInterface;
2121

2222
public function headers(): array
2323
{

src/Interfaces/ApiInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace WrkFlow\ApiSdkBuilder\Interfaces;
66

77
use Closure;
8-
use JustSteveKing\UriBuilder\Uri;
98
use Psr\Http\Message\ResponseInterface;
9+
use Psr\Http\Message\UriInterface;
1010
use Throwable;
1111
use WrkFlow\ApiSdkBuilder\Contracts\ApiFactoryContract;
1212
use WrkFlow\ApiSdkBuilder\Environments\AbstractEnvironment;
@@ -27,7 +27,7 @@ public function environment(): AbstractEnvironment;
2727

2828
public function factory(): ApiFactoryContract;
2929

30-
public function uri(): Uri;
30+
public function uri(): UriInterface;
3131

3232
public function createFailedResponseException(int $statusCode, ResponseInterface $response): ResponseException;
3333
}

src/Testing/ApiMock.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
namespace WrkFlow\ApiSdkBuilder\Testing;
66

77
use Closure;
8-
use JustSteveKing\UriBuilder\Uri;
8+
use GuzzleHttp\Psr7\Uri;
99
use Psr\Http\Message\ResponseInterface;
10+
use Psr\Http\Message\UriInterface;
1011
use WrkFlow\ApiSdkBuilder\Contracts\ApiFactoryContract;
1112
use WrkFlow\ApiSdkBuilder\Environments\AbstractEnvironment;
1213
use WrkFlow\ApiSdkBuilder\Exceptions\ResponseException;
@@ -31,9 +32,9 @@ public function factory(): ApiFactoryContract
3132
return new ApiFactoryMock();
3233
}
3334

34-
public function uri(): Uri
35+
public function uri(): UriInterface
3536
{
36-
return Uri::fromString('https://test.localhost');
37+
return new Uri('https://test.localhost');
3738
}
3839

3940
public function createFailedResponseException(int $statusCode, ResponseInterface $response): ResponseException

src/Testing/Environments/TestingEnvironment.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
namespace WrkFlow\ApiSdkBuilder\Testing\Environments;
66

7-
use JustSteveKing\UriBuilder\Uri;
7+
use GuzzleHttp\Psr7\Uri;
88
use WrkFlow\ApiSdkBuilder\Environments\AbstractEnvironment;
99

1010
class TestingEnvironment extends AbstractEnvironment
1111
{
1212
public function uri(): Uri
1313
{
14-
return Uri::fromString('https://localhost/test');
14+
return new Uri('https://localhost/test');
1515
}
1616
}

0 commit comments

Comments
 (0)