<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\DI\Scope;

use PpPhp\Core\Platform\DI\Contracts\ScopeInterface;

final class Scope implements ScopeInterface
{
    private array $instances = [];
    public function __construct(private readonly string $id) {}
    public function id(): string { return $this->id; }
    public function has(string $id): bool { return array_key_exists($id, $this->instances); }
    public function get(string $id): mixed { return $this->instances[$id] ?? null; }
    public function set(string $id, mixed $value): void { $this->instances[$id] = $value; }
    public function clear(): void { $this->instances = []; }
}
