Refactor SMS Provider Classes to Support Nullable API Key and Sender
- Updated KavehNegarProvider and RanginehProvider constructors to accept nullable API key and sender parameters. - Adjusted methods in both providers to handle cases where the API key or sender may not be set, preventing potential TypeErrors. - Modified community IDs in graph.json for various entities to reflect updated associations. - Updated manifest.json with new modification times and AST hashes for KavehNegarProvider and RanginehProvider. - Added new AST cache files for KavehNegarProvider and RanginehProvider reflecting the latest structure and relationships.
This commit is contained in:
@@ -12,12 +12,14 @@ class KavehNegarProvider implements SmsProviderInterface
|
||||
public function __construct(
|
||||
private readonly HttpClientInterface $httpClient,
|
||||
private readonly SiteConfigRepository $configRepo,
|
||||
private readonly string $apiKey = '',
|
||||
private readonly string $sender = '',
|
||||
// Nullable: env `%env(default::KAVENEGAR_API_KEY)%` resolves to null when unset
|
||||
// (the real key normally comes from DB site config below, not env).
|
||||
private readonly ?string $apiKey = null,
|
||||
private readonly ?string $sender = null,
|
||||
) {}
|
||||
|
||||
private function key(): string { return $this->configRepo->get('kavenegar_api_key') ?: $this->apiKey; }
|
||||
private function sender(): string { return $this->configRepo->get('kavenegar_sender') ?: $this->sender; }
|
||||
private function key(): string { return $this->configRepo->get('kavenegar_api_key') ?: ($this->apiKey ?? ''); }
|
||||
private function sender(): string { return $this->configRepo->get('kavenegar_sender') ?: ($this->sender ?? ''); }
|
||||
|
||||
public function getName(): string { return 'kavenegar'; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user