From 5ab43ffc73b56f0b1943e460b30c2e90bef5a1a2 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Thu, 14 Jul 2022 09:38:59 +0200 Subject: [PATCH] make sender number and sender country optional --- src/Application/Model/Configuration.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Application/Model/Configuration.php b/src/Application/Model/Configuration.php index 3a52c73..90f8777 100644 --- a/src/Application/Model/Configuration.php +++ b/src/Application/Model/Configuration.php @@ -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; } }