hashMap = new HashMap(); } /** * @param string $key * @param $handler */ public function add(string $key, $handler) { $this->hashMap->put($key, $handler); } /** * @param string $key * @return bool */ #[Pure] public function has(string $key): bool { return $this->hashMap->has($key); } /** * @param string $key * @return OnTaskInterface * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function get(string $key): OnTaskInterface { $task = $this->hashMap->get($key); if (is_string($task)) { $task = $this->container->get($task); if (!empty($task)) { $this->add($key, $task); } } return $task; } }