*/ class FactoryRuntimeLoader implements RuntimeLoaderInterface { /** * @param array $map An array where keys are class names and values factory callables */ public function __construct( private array $map = [], ) { } public function load(string $class) { if (!isset($this->map[$class])) { return null; } $runtimeFactory = $this->map[$class]; return $runtimeFactory(); } }