container = $container; } public function get(string $class): Endpoint { $endpoint = $this->container->get($class); if (!$endpoint instanceof Endpoint) { throw new InvalidStateException(sprintf("Class '%s' doesn't implement '%s'", $class, Endpoint::class)); } return $endpoint; } }