From 110f7af739f447101afc348eab07d2ad243a2ea9 Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Mon, 7 Dec 2020 00:27:01 +0800 Subject: [PATCH] fixed configuration read bug in SmsManager --- src/SmsManager.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/SmsManager.php b/src/SmsManager.php index 0ca7103..b5daffa 100644 --- a/src/SmsManager.php +++ b/src/SmsManager.php @@ -50,7 +50,7 @@ class SmsManager implements SmsManagerInterface public function __construct(ContainerInterface $container) { $this->container = $container; - $this->config = $container->get(ConfigInterface::class); + $this->config = $container->get(ConfigInterface::class)->get('sms'); } public function get(string $name): SenderInterface @@ -139,7 +139,7 @@ protected function applyStrategy(SmsableInterface $smsable): array */ protected function resolve(string $name): SenderInterface { - $config = $this->getConfig($name); + $config = $this->config['senders'][$name] ?? null; if (is_null($config)) { throw new InvalidArgumentException("The SMS sender [{$name}] is not defined."); @@ -147,14 +147,4 @@ protected function resolve(string $name): SenderInterface return make(Sender::class, compact('name', 'config')); } - - /** - * Get the mail connection configuration. - * - * @return array - */ - protected function getConfig(string $name) - { - return $this->config->get("sms.senders.{$name}"); - } }