Skip to content

Commit

Permalink
fixed configuration read bug in SmsManager
Browse files Browse the repository at this point in the history
  • Loading branch information
ericyzhu committed Dec 6, 2020
1 parent 4d1a3c2 commit 110f7af
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/SmsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -139,22 +139,12 @@ 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.");
}

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}");
}
}

0 comments on commit 110f7af

Please sign in to comment.