use assertion exception
This commit is contained in:
parent
e8da35995e
commit
14a26a602b
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\LinkmobilityClient;
|
namespace D3\LinkmobilityClient;
|
||||||
|
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\LinkmobilityClient\Request\RequestInterface;
|
use D3\LinkmobilityClient\Request\RequestInterface;
|
||||||
use D3\LinkmobilityClient\Url\Url;
|
use D3\LinkmobilityClient\Url\Url;
|
||||||
use D3\LinkmobilityClient\Url\UrlInterface;
|
use D3\LinkmobilityClient\Url\UrlInterface;
|
||||||
@ -25,7 +26,6 @@ use GuzzleHttp\HandlerStack;
|
|||||||
use GuzzleHttp\MessageFormatter;
|
use GuzzleHttp\MessageFormatter;
|
||||||
use GuzzleHttp\Middleware;
|
use GuzzleHttp\Middleware;
|
||||||
use GuzzleRetry\GuzzleRetryMiddleware;
|
use GuzzleRetry\GuzzleRetryMiddleware;
|
||||||
use InvalidArgumentException;
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
class Client
|
class Client
|
||||||
|
@ -16,6 +16,7 @@ declare(strict_types=1);
|
|||||||
namespace D3\LinkmobilityClient\Request;
|
namespace D3\LinkmobilityClient\Request;
|
||||||
|
|
||||||
use Assert\Assert;
|
use Assert\Assert;
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\LinkmobilityClient\Client;
|
use D3\LinkmobilityClient\Client;
|
||||||
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
|
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
|
||||||
use D3\LinkmobilityClient\RecipientsList\RecipientsList;
|
use D3\LinkmobilityClient\RecipientsList\RecipientsList;
|
||||||
@ -26,7 +27,6 @@ use D3\LinkmobilityClient\ValueObject\Sender;
|
|||||||
use D3\LinkmobilityClient\ValueObject\SmsMessageAbstract;
|
use D3\LinkmobilityClient\ValueObject\SmsMessageAbstract;
|
||||||
use D3\LinkmobilityClient\ValueObject\SmsMessageInterface;
|
use D3\LinkmobilityClient\ValueObject\SmsMessageInterface;
|
||||||
use GuzzleHttp\RequestOptions;
|
use GuzzleHttp\RequestOptions;
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
abstract class Request implements RequestInterface
|
abstract class Request implements RequestInterface
|
||||||
{
|
{
|
||||||
|
@ -15,10 +15,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\LinkmobilityClient\Request;
|
namespace D3\LinkmobilityClient\Request;
|
||||||
|
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\LinkmobilityClient\Client;
|
use D3\LinkmobilityClient\Client;
|
||||||
use D3\LinkmobilityClient\RecipientsList\RecipientsListInterface;
|
use D3\LinkmobilityClient\RecipientsList\RecipientsListInterface;
|
||||||
use D3\LinkmobilityClient\ValueObject\SmsMessageInterface;
|
use D3\LinkmobilityClient\ValueObject\SmsMessageInterface;
|
||||||
use InvalidArgumentException;
|
|
||||||
use Psr\Http\Message\ResponseInterface as PsrResponseInterface;
|
use Psr\Http\Message\ResponseInterface as PsrResponseInterface;
|
||||||
use D3\LinkmobilityClient\Response\ResponseInterface as LMResponseInterface;
|
use D3\LinkmobilityClient\Response\ResponseInterface as LMResponseInterface;
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@ declare(strict_types=1);
|
|||||||
namespace D3\LinkmobilityClient\SMS;
|
namespace D3\LinkmobilityClient\SMS;
|
||||||
|
|
||||||
use Assert\Assert;
|
use Assert\Assert;
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\LinkmobilityClient\Request\Request;
|
use D3\LinkmobilityClient\Request\Request;
|
||||||
use D3\LinkmobilityClient\Url\Url;
|
use D3\LinkmobilityClient\Url\Url;
|
||||||
use D3\LinkmobilityClient\ValueObject\SmsBinaryMessage;
|
use D3\LinkmobilityClient\ValueObject\SmsBinaryMessage;
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class BinaryRequest extends Request implements SmsRequestInterface
|
class BinaryRequest extends Request implements SmsRequestInterface
|
||||||
{
|
{
|
||||||
|
@ -16,10 +16,10 @@ declare(strict_types=1);
|
|||||||
namespace D3\LinkmobilityClient\SMS;
|
namespace D3\LinkmobilityClient\SMS;
|
||||||
|
|
||||||
use Assert\Assert;
|
use Assert\Assert;
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\LinkmobilityClient\Request\Request;
|
use D3\LinkmobilityClient\Request\Request;
|
||||||
use D3\LinkmobilityClient\Url\Url;
|
use D3\LinkmobilityClient\Url\Url;
|
||||||
use D3\LinkmobilityClient\ValueObject\SmsTextMessage;
|
use D3\LinkmobilityClient\ValueObject\SmsTextMessage;
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class TextRequest extends Request implements SmsRequestInterface
|
class TextRequest extends Request implements SmsRequestInterface
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@ declare(strict_types=1);
|
|||||||
namespace D3\LinkmobilityClient\ValueObject;
|
namespace D3\LinkmobilityClient\ValueObject;
|
||||||
|
|
||||||
use Assert\Assert;
|
use Assert\Assert;
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
|
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
|
||||||
use D3\LinkmobilityClient\Exceptions\RecipientException;
|
use D3\LinkmobilityClient\Exceptions\RecipientException;
|
||||||
use libphonenumber\NumberParseException;
|
use libphonenumber\NumberParseException;
|
||||||
@ -44,6 +45,7 @@ class Recipient extends StringValueObject
|
|||||||
*
|
*
|
||||||
* @throws NumberParseException
|
* @throws NumberParseException
|
||||||
* @throws RecipientException
|
* @throws RecipientException
|
||||||
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function __construct(string $number, string $iso2CountryCode)
|
public function __construct(string $number, string $iso2CountryCode)
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@ declare(strict_types=1);
|
|||||||
namespace D3\LinkmobilityClient\ValueObject;
|
namespace D3\LinkmobilityClient\ValueObject;
|
||||||
|
|
||||||
use Assert\Assert;
|
use Assert\Assert;
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
|
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
|
||||||
use D3\LinkmobilityClient\Exceptions\NoSenderDefinedException;
|
use D3\LinkmobilityClient\Exceptions\NoSenderDefinedException;
|
||||||
use D3\LinkmobilityClient\Exceptions\RecipientException;
|
use D3\LinkmobilityClient\Exceptions\RecipientException;
|
||||||
@ -32,6 +33,7 @@ class Sender extends ValueObject
|
|||||||
*
|
*
|
||||||
* @throws NumberParseException
|
* @throws NumberParseException
|
||||||
* @throws RecipientException
|
* @throws RecipientException
|
||||||
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function __construct(string $number = null, string $iso2CountryCode = null)
|
public function __construct(string $number = null, string $iso2CountryCode = null)
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\LinkmobilityClient\ValueObject;
|
namespace D3\LinkmobilityClient\ValueObject;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
use Assert\InvalidArgumentException;
|
||||||
|
|
||||||
class SmsTextMessage extends SmsMessageAbstract
|
class SmsTextMessage extends SmsMessageAbstract
|
||||||
{
|
{
|
||||||
|
@ -16,11 +16,16 @@ declare(strict_types=1);
|
|||||||
namespace D3\LinkmobilityClient\ValueObject;
|
namespace D3\LinkmobilityClient\ValueObject;
|
||||||
|
|
||||||
use Assert\Assert;
|
use Assert\Assert;
|
||||||
|
use Assert\InvalidArgumentException;
|
||||||
|
|
||||||
abstract class ValueObject
|
abstract class ValueObject
|
||||||
{
|
{
|
||||||
protected $value;
|
protected $value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $number
|
||||||
|
* @throws InvalidArgumentException
|
||||||
|
*/
|
||||||
public function __construct(string $number)
|
public function __construct(string $number)
|
||||||
{
|
{
|
||||||
Assert::that($number)->notEmpty();
|
Assert::that($number)->notEmpty();
|
||||||
|
Loading…
Reference in New Issue
Block a user