<?php

namespace App\Framework\View;

use App\Framework\DI\Container;

final class ProcessorResolver
{
    private array $resolvedProcessors = [];
    public function __construct(
        private readonly Container $container,
    ){}

    public function resolve(string $processorClass): object
    {
        if(!isset($this->resolvedProcessors[$processorClass])) {
            $this->resolvedProcessors[$processorClass] = $this->container->get($processorClass);
        }
        return $this->resolvedProcessors[$processorClass];
    }
}
