Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function drop(string $key): void

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

public function generateOutput(array $fromArr = ["data", "fileData", "set"])
Expand Down
4 changes: 2 additions & 2 deletions Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public function getPath(): string
{
if (is_null($this->path)) {
$basePath = '';
$requestName = Format\Str::value($this->get("SCRIPT_NAME"))->extractPath()->get();
$requestName = Format\Str::value($this->get("SCRIPT_NAME"))->getUrlPath()->get();
$requestDir = dirname($requestName);
$requestUri = Format\Str::value($this->get("REQUEST_URI"))->extractPath()->get();
$requestUri = Format\Str::value($this->get("REQUEST_URI"))->getUrlPath()->get();

$this->path = $requestUri;
if (stripos($requestUri, $requestName) === 0) {
Expand Down
10 changes: 7 additions & 3 deletions Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ public function getDefaultPort(): ?int
public function getPath(): string
{
if ($val = $this->getUniquePart("path")) {
$this->encoded['path'] = Format\Str::value($val)->toggleUrlencode(['%2F'], ['/'])->get();
$this->encoded['path'] = Format\Str::value($val)
->normalizeUrlEncoding()
->replace(['%2F'], ['/'])
->get();
if($this->encoded['path']) {
$this->encoded['path'] = "/".ltrim($this->encoded['path'], "/");
}
Expand All @@ -229,8 +232,9 @@ public function getQuery(): string
{
if ($val = $this->getUniquePart("query")) {
$this->encoded['query'] = Format\Str::value($val)
->toggleUrlencode(['%3D', '%26', '%5B', '%5D'], ['=', '&', '[', ']'])
->get();
->normalizeUrlEncoding()
->replace(['%3D', '%26', '%5B', '%5D'], ['=', '&', '[', ']'])
->get();
}
return (string)$this->encoded['query'];
}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maplephp/http",
"version": "v1.2.2",
"version": "v1.2.3",
"type": "library",
"description": "MaplePHP/Http is a powerful and easy-to-use PHP library that fully supports the PSR-7 HTTP message interfaces.",
"keywords": [
Expand Down Expand Up @@ -29,7 +29,7 @@
],
"require": {
"php": ">=8.0",
"maplephp/dto": "^2.0"
"maplephp/dto": "^3.0"
},
"require-dev": {
"maplephp/unitary": "^1.0"
Expand Down