move exception message to constant in messages class

This commit is contained in:
Daniel Seifert 2022-07-14 12:05:06 +02:00
parent f1eae3bd87
commit aa88f09e16
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
2 changed files with 4 additions and 1 deletions

View File

@ -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';
}

View File

@ -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