XgSmsSender::class, 'zhongwang' => ZwSmsSender::class, 'juhedata' => JhSmsSender::class, ]; public function __invoke(ContainerInterface $container) { $tool = Tool::getActiveByGroup('sms'); if (!$tool) { return null; } $senderClass = $this->getSenderClass($tool); if ($senderClass) { return make($senderClass, compact('tool')); } return null; } protected function getSenderClass(Tool $tool) { return $this->senders[$tool->name] ?? null; } }