<?php

namespace App\Framework\Http;

/**
 * Value Object für URLs/URIs
 */
final readonly class Uri
{
    public function __construct(
        public string $value
    ) {}

    public function getPath(): string
    {
        return parse_url($this->value, PHP_URL_PATH) ?? '/';
    }

    public function getQuery(): string
    {
        return parse_url($this->value, PHP_URL_QUERY) ?? '';
    }

    public function __toString(): string
    {
        return $this->value;
    }
}
