diff --git a/src/Exceptions/ExceptionMessages.php b/src/Exceptions/ExceptionMessages.php index 99ae8f9..abae814 100644 --- a/src/Exceptions/ExceptionMessages.php +++ b/src/Exceptions/ExceptionMessages.php @@ -25,5 +25,7 @@ class ExceptionMessages public const NOT_A_MOBILE_NUMBER = 'not a mobile number'; + public const EMPTY_RECIPIENT_LIST = 'request must contain a valid recipient'; + public const DEBUG_NOSENDERORCOUNTRYCODE= 'no sender number or sender country code defined, use fallback to account default'; } diff --git a/src/Request/Request.php b/src/Request/Request.php index 3483bfe..5278007 100644 --- a/src/Request/Request.php +++ b/src/Request/Request.php @@ -17,6 +17,7 @@ namespace D3\LinkmobilityClient\Request; use Assert\Assert; use D3\LinkmobilityClient\Client; +use D3\LinkmobilityClient\Exceptions\ExceptionMessages; use D3\LinkmobilityClient\RecipientsList\RecipientsList; use D3\LinkmobilityClient\RecipientsList\RecipientsListInterface; use D3\LinkmobilityClient\Response\ResponseInterface; @@ -140,7 +141,7 @@ abstract class Request implements RequestInterface Assert::that($this->getOptions())->isArray(); Assert::that($this->getRecipientsList())->isInstanceOf(RecipientsList::class)->notEmpty(); - Assert::that($this->getRecipientsList()->getRecipients())->notEmpty('request must contain a valid recipient'); + Assert::that($this->getRecipientsList()->getRecipients())->notEmpty(ExceptionMessages::EMPTY_RECIPIENT_LIST); Assert::thatAll($this->getRecipientsList())->isInstanceOf(Recipient::class)->notEmpty(); // optional properties