From 45220806fc16382cd84fd55cc075f60f35a4b6cb Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Mon, 23 Oct 2023 13:19:29 +0200 Subject: [PATCH] Throw exception for unregistered profile --- src/Core.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Core.php b/src/Core.php index 09eca52..862bc2b 100644 --- a/src/Core.php +++ b/src/Core.php @@ -25,11 +25,15 @@ protected function getConnection($connector_id) { } public function getConnectionProfile($connector_id) { - $entity = CMRFConnector::load($connector_id); - if ($entity == NULL) { + $connector = CMRFConnector::load($connector_id); + if ($connector == NULL) { throw new \Exception("Unregistered connector '$connector_id'.", 1); } - return $this->getConnectionProfiles()[$entity->profile]; + $profiles = $this->getConnectionProfiles(); + if (!isset($profiles[$connector->profile])) { + throw new \Exception("Unregistered profile '{$connector->profile}'.", 1); + } + return $profiles[$connector->profile]; }