use assertion exception

This commit is contained in:
Daniel Seifert 2023-02-02 00:07:12 +01:00
parent e8da35995e
commit 14a26a602b
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
9 changed files with 15 additions and 6 deletions

View File

@ -15,6 +15,7 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient;
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Request\RequestInterface;
use D3\LinkmobilityClient\Url\Url;
use D3\LinkmobilityClient\Url\UrlInterface;
@ -25,7 +26,6 @@ use GuzzleHttp\HandlerStack;
use GuzzleHttp\MessageFormatter;
use GuzzleHttp\Middleware;
use GuzzleRetry\GuzzleRetryMiddleware;
use InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;
class Client

View File

@ -16,6 +16,7 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\Request;
use Assert\Assert;
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Client;
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
use D3\LinkmobilityClient\RecipientsList\RecipientsList;
@ -26,7 +27,6 @@ use D3\LinkmobilityClient\ValueObject\Sender;
use D3\LinkmobilityClient\ValueObject\SmsMessageAbstract;
use D3\LinkmobilityClient\ValueObject\SmsMessageInterface;
use GuzzleHttp\RequestOptions;
use InvalidArgumentException;
abstract class Request implements RequestInterface
{

View File

@ -15,10 +15,10 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\Request;
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Client;
use D3\LinkmobilityClient\RecipientsList\RecipientsListInterface;
use D3\LinkmobilityClient\ValueObject\SmsMessageInterface;
use InvalidArgumentException;
use Psr\Http\Message\ResponseInterface as PsrResponseInterface;
use D3\LinkmobilityClient\Response\ResponseInterface as LMResponseInterface;

View File

@ -16,10 +16,10 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\SMS;
use Assert\Assert;
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Request\Request;
use D3\LinkmobilityClient\Url\Url;
use D3\LinkmobilityClient\ValueObject\SmsBinaryMessage;
use InvalidArgumentException;
class BinaryRequest extends Request implements SmsRequestInterface
{

View File

@ -16,10 +16,10 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\SMS;
use Assert\Assert;
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Request\Request;
use D3\LinkmobilityClient\Url\Url;
use D3\LinkmobilityClient\ValueObject\SmsTextMessage;
use InvalidArgumentException;
class TextRequest extends Request implements SmsRequestInterface
{

View File

@ -16,6 +16,7 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\ValueObject;
use Assert\Assert;
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
use D3\LinkmobilityClient\Exceptions\RecipientException;
use libphonenumber\NumberParseException;
@ -44,6 +45,7 @@ class Recipient extends StringValueObject
*
* @throws NumberParseException
* @throws RecipientException
* @throws InvalidArgumentException
*/
public function __construct(string $number, string $iso2CountryCode)
{

View File

@ -16,6 +16,7 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\ValueObject;
use Assert\Assert;
use Assert\InvalidArgumentException;
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
use D3\LinkmobilityClient\Exceptions\NoSenderDefinedException;
use D3\LinkmobilityClient\Exceptions\RecipientException;
@ -32,6 +33,7 @@ class Sender extends ValueObject
*
* @throws NumberParseException
* @throws RecipientException
* @throws InvalidArgumentException
*/
public function __construct(string $number = null, string $iso2CountryCode = null)
{

View File

@ -15,7 +15,7 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\ValueObject;
use InvalidArgumentException;
use Assert\InvalidArgumentException;
class SmsTextMessage extends SmsMessageAbstract
{

View File

@ -16,11 +16,16 @@ declare(strict_types=1);
namespace D3\LinkmobilityClient\ValueObject;
use Assert\Assert;
use Assert\InvalidArgumentException;
abstract class ValueObject
{
protected $value;
/**
* @param string $number
* @throws InvalidArgumentException
*/
public function __construct(string $number)
{
Assert::that($number)->notEmpty();