diff --git a/SearchEndpoint/SearchEndpointFactory.php b/SearchEndpoint/SearchEndpointFactory.php index f6937eb29411ec1745d3cb80b07a54b33f1b63be..d319c6527c799dd62471898872d867d4e1911548 100644 --- a/SearchEndpoint/SearchEndpointFactory.php +++ b/SearchEndpoint/SearchEndpointFactory.php @@ -37,19 +37,13 @@ class SearchEndpointFactory * @return SearchEndpointInterface * * @throws \RuntimeException Endpoint does not exist. - * @throws \DomainException Endpoint is not implementing SearchEndpointInterface. */ public static function get($type) { if (!array_key_exists($type, self::$endpoints)) { - throw new \RuntimeException(); + throw new \RuntimeException('Endpoint does not exist.'); } - $endpoint = new self::$endpoints[$type](); - if ($endpoint instanceof SearchEndpointInterface) { - return $endpoint; - } - - throw new \DomainException(); + return new self::$endpoints[$type](); } }