make sender number and sender country optional

This commit is contained in:
Daniel Seifert 2022-07-14 09:38:59 +02:00
parent 1ed3ae40ef
commit 5ab43ffc73
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
1 changed files with 7 additions and 8 deletions

View File

@ -41,26 +41,25 @@ class Configuration
}
/**
* @return string
* @return string|null
*/
public function getSmsSenderNumber(): string
public function getSmsSenderNumber()
{
$number = trim(Registry::getConfig()->getConfigParam('d3linkmobility_smsSenderNumber'));
Assert::that($number)->string()->notEmpty();
return $number;
return strlen($number) ? $number : null;
}
/**
* @return string
* @return string|null
*/
public function getSmsSenderCountry(): string
{
$country = trim(Registry::getConfig()->getConfigParam('d3linkmobility_smsSenderCountry'));
$country = strlen($country) ? strtoupper($country) : null;
Assert::that($country)->string()->length(2);
Assert::that($country)->null() || Assert::that($country)->string()->length(2);
return strtoupper($country);
return $country;
}
}