diff --git a/src/Configuration.php b/src/Configuration.php index 2b771f8..1b29528 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -76,7 +76,7 @@ public function setUseragent(string $useragent) * * @return Configuration */ - public static function getInstance(): Configuration + public static function getInstance(): self { if (is_null(static::$instance)) { static::$instance = new self(); diff --git a/src/Easi.php b/src/Easi.php index a5ffd89..87349f4 100644 --- a/src/Easi.php +++ b/src/Easi.php @@ -72,12 +72,13 @@ public function setToken(string $token): void * * @return Easi */ - public function __get(string $name): Easi + public function __get(string $name): self { $endpoint = __NAMESPACE__.'\\Api\\Endpoints\\'.ucfirst($name); if (!class_exists($endpoint)) { $this->getConfig()->getLogger()->error('Endpoint {endpoint] not found!', ['endpoint' => $endpoint]); + throw new EndpointNotFoundException(); } @@ -99,13 +100,14 @@ public function getConfig(): Configuration /** * Call endpoint method. * - * @param string $name Method name - * @param array $arguments + * @param string $name Method name + * @param array $arguments * - * @return Response * @throws EndpointNotFoundException * @throws Exceptions\ApiException * @throws MethodNotFoundException + * + * @return Response */ public function __call(string $name, array $arguments): Response { @@ -126,6 +128,7 @@ public function __call(string $name, array $arguments): Response if (!method_exists($instance, $name)) { $this->getConfig()->getLogger()->error('{endpoint}::{method} not found!', ['endpoint' => $endpoint, 'method' => $name]); + throw new MethodNotFoundException(); }