*/ public array $services = []; public function setService(string $name, mixed $service): void { $this->services[$name] = $service; } /** * @param string $id * @return mixed */ public function get($id) { if (! $this->has($id)) { throw new RuntimeException(sprintf('Service not found "%s"', $id)); } return $this->services[$id]; } /** * @param string $id * @return bool */ public function has($id) { return array_key_exists($id, $this->services); } }