<?php

namespace Planaday\Utility\DependencyInjection;

class ImplementationRegister {
	/** @var array<class-string, class-string> */
	protected array $implementations = [];

	/**
	 * @template C
	 * @param class-string<C> $class
	 *
	 * @return class-string<C>|null
	 */
	public function get(string $class): ?string{
		return $this->implementations[$class] ?? null;
	}

	/**
	 * @template C
	 * @template I of C
	 * @param class-string<C> $class
	 * @param class-string<I> $implementationClass
	 *
	 * @return void
	 */
	public function set(string $class, string $implementationClass): void{
		$this->implementations[$class] = $implementationClass;
	}
}