Skip to content
Snippets Groups Projects
Commit 26a92273 authored by Martynas Sudintas's avatar Martynas Sudintas
Browse files

Removed check for instance in SearchEndpointFactory

parent 5984d03f
No related branches found
No related tags found
No related merge requests found
...@@ -37,19 +37,13 @@ class SearchEndpointFactory ...@@ -37,19 +37,13 @@ class SearchEndpointFactory
* @return SearchEndpointInterface * @return SearchEndpointInterface
* *
* @throws \RuntimeException Endpoint does not exist. * @throws \RuntimeException Endpoint does not exist.
* @throws \DomainException Endpoint is not implementing SearchEndpointInterface.
*/ */
public static function get($type) public static function get($type)
{ {
if (!array_key_exists($type, self::$endpoints)) { if (!array_key_exists($type, self::$endpoints)) {
throw new \RuntimeException(); throw new \RuntimeException();
} }
$endpoint = new self::$endpoints[$type]();
if ($endpoint instanceof SearchEndpointInterface) { return new self::$endpoints[$type]();
return $endpoint;
}
throw new \DomainException();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment