From 21f76b085bf403b6d6a2b28e508027880f0e1fc3 Mon Sep 17 00:00:00 2001 From: Benjamin Calef Date: Mon, 19 Feb 2024 12:42:23 +0100 Subject: [PATCH] [v2.0.0] add missing phpdoc for apiPool --- Service/ApiPool.php | 11 ++++++++++- Service/ApiPoolInterface.php | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Service/ApiPool.php b/Service/ApiPool.php index a8bd7be..87593b4 100644 --- a/Service/ApiPool.php +++ b/Service/ApiPool.php @@ -16,6 +16,7 @@ namespace Zepgram\Rest\Service; use ReflectionClass; +use ReflectionException; use Zepgram\Rest\Exception\Technical\LogicException; use Zepgram\Rest\Model\RequestAdapter; @@ -26,9 +27,17 @@ public function __construct( ) { } + /** + * @inheirtDoc + */ public function execute(string $adapterName, array $rawData = []): mixed { - $requestAdapterName = new ReflectionClass($adapterName); + try { + $requestAdapterName = new ReflectionClass($adapterName); + } catch (ReflectionException $e) { + throw new LogicException(__($adapterName . ' must be an instance of RequestAdapter'), $e); + } + if (!$requestAdapterName->isSubclassOf(RequestAdapter::class)) { throw new LogicException(__($requestAdapterName . ' must be an instance of RequestAdapter')); } diff --git a/Service/ApiPoolInterface.php b/Service/ApiPoolInterface.php index fd0f6cc..ef550a7 100644 --- a/Service/ApiPoolInterface.php +++ b/Service/ApiPoolInterface.php @@ -15,12 +15,23 @@ namespace Zepgram\Rest\Service; +use Zepgram\Rest\Exception\ExternalException; +use Zepgram\Rest\Exception\InternalException; +use Zepgram\Rest\Exception\Technical\InvalidContractException; +use Zepgram\Rest\Exception\Technical\LogicException; +use Zepgram\Rest\Exception\Technical\MissingBaseUriException; + interface ApiPoolInterface { /** * @param string $adapterName * @param array $rawData * @return mixed + * @throws InternalException + * @throws InvalidContractException + * @throws LogicException + * @throws MissingBaseUriException + * @throws ExternalException */ public function execute(string $adapterName, array $rawData = []): mixed; }