<?php

declare(strict_types=1);

namespace PpPhp\Core\Platform\Services\Registry;

final class AliasRegistry
{
    /** @var array<string, string> */
    private array $aliases = [];

    public function register(string $alias, string $target): void
    {
        $this->aliases[$alias] = $target;
    }

    public function has(string $alias): bool
    {
        return isset($this->aliases[$alias]);
    }

    public function resolve(string $id): string
    {
        return $this->aliases[$id] ?? $id;
    }

    public function all(): array
    {
        return $this->aliases;
    }
}
