getUser(); $secret = $dsn->getPassword(); $this->sms = match ($dsn->getHost()) { 'mock' => new Mock('', ''), // used for tests 'twilio' => new Twilio($user, $secret), 'text-magic' => new TextMagic($user, $secret), 'telesign' => new Telesign($user, $secret), 'msg91' => new Msg91($user, $secret), 'vonage' => new Vonage($user, $secret), default => null }; $this->from = App::getEnv('_APP_SMS_FROM'); } public function run(): void { if (empty(App::getEnv('_APP_SMS_PROVIDER'))) { Console::info('Skipped sms processing. No Phone provider has been set.'); return; } if (empty($this->from)) { Console::info('Skipped sms processing. No phone number has been set.'); return; } $recipient = $this->args['recipient']; $message = $this->args['message']; try { $this->sms->send($this->from, $recipient, $message); } catch (\Exception $error) { throw new Exception('Error sending message: ' . $error->getMessage(), 500); } } public function shutdown(): void { } }