Skip to content

Commit 4ce33b7

Browse files
authored
Merge pull request #3 from MaplePHP/develop
Add DTO v3.0.0
2 parents 7a98a0e + af1220c commit 4ce33b7

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

Env.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public function drop(string $key): void
5757

5858
public function formatKey($key)
5959
{
60-
return Format\Str::value($key)->clearBreaks()->trim()->replaceSpecialChar()
61-
->trimSpaces()->replaceSpaces("-")->toUpper()->get();
60+
return Format\Str::value($key)->clearBreaks()->trim()->normalizeAccents()
61+
->normalizeSeparators()->replaceSpaces("-")->toUpper()->get();
6262
}
6363

6464
public function generateOutput(array $fromArr = ["data", "fileData", "set"])

Environment.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ public function getPath(): string
7777
{
7878
if (is_null($this->path)) {
7979
$basePath = '';
80-
$requestName = Format\Str::value($this->get("SCRIPT_NAME"))->extractPath()->get();
80+
$requestName = Format\Str::value($this->get("SCRIPT_NAME"))->getUrlPath()->get();
8181
$requestDir = dirname($requestName);
82-
$requestUri = Format\Str::value($this->get("REQUEST_URI"))->extractPath()->get();
82+
$requestUri = Format\Str::value($this->get("REQUEST_URI"))->getUrlPath()->get();
8383

8484
$this->path = $requestUri;
8585
if (stripos($requestUri, $requestName) === 0) {

Uri.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,10 @@ public function getDefaultPort(): ?int
213213
public function getPath(): string
214214
{
215215
if ($val = $this->getUniquePart("path")) {
216-
$this->encoded['path'] = Format\Str::value($val)->toggleUrlencode(['%2F'], ['/'])->get();
216+
$this->encoded['path'] = Format\Str::value($val)
217+
->normalizeUrlEncoding()
218+
->replace(['%2F'], ['/'])
219+
->get();
217220
if($this->encoded['path']) {
218221
$this->encoded['path'] = "/".ltrim($this->encoded['path'], "/");
219222
}
@@ -229,8 +232,9 @@ public function getQuery(): string
229232
{
230233
if ($val = $this->getUniquePart("query")) {
231234
$this->encoded['query'] = Format\Str::value($val)
232-
->toggleUrlencode(['%3D', '%26', '%5B', '%5D'], ['=', '&', '[', ']'])
233-
->get();
235+
->normalizeUrlEncoding()
236+
->replace(['%3D', '%26', '%5B', '%5D'], ['=', '&', '[', ']'])
237+
->get();
234238
}
235239
return (string)$this->encoded['query'];
236240
}

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "maplephp/http",
3-
"version": "v1.2.2",
3+
"version": "v1.2.3",
44
"type": "library",
55
"description": "MaplePHP/Http is a powerful and easy-to-use PHP library that fully supports the PSR-7 HTTP message interfaces.",
66
"keywords": [
@@ -29,7 +29,7 @@
2929
],
3030
"require": {
3131
"php": ">=8.0",
32-
"maplephp/dto": "^2.0"
32+
"maplephp/dto": "^3.0"
3333
},
3434
"require-dev": {
3535
"maplephp/unitary": "^1.0"

0 commit comments

Comments
 (0)