Skip to content
Snippets Groups Projects
Commit 42a28cab authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

Merge pull request #387 from martiis/endpoint_factory_messages

Endpoint factory messages
parents e2ce2ebf 1f37e8b5
No related branches found
No related tags found
No related merge requests found
......@@ -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]();
}
}
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