Files
many-notes/app/Actions/ResolveTwoPaths.php
2025-01-27 19:51:06 +00:00

20 lines
430 B
PHP

<?php
declare(strict_types=1);
namespace App\Actions;
use GuzzleHttp\Psr7\UriResolver;
use GuzzleHttp\Psr7\Utils;
final readonly class ResolveTwoPaths
{
public function handle(string $currentPath, string $path): string
{
$uri = Utils::uriFor(mb_trim($path));
$resolvedUri = (string) UriResolver::resolve(Utils::uriFor(mb_trim($currentPath)), $uri);
return mb_ltrim($resolvedUri, '/');
}
}