diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 244806f..f0512a0 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -6,7 +6,7 @@ $finder = PhpCsFixer\Finder::create() $config = new PhpCsFixer\Config(); return $config->setRules([ - '@PHP70Migration' => true, + '@PHP73Migration' => true, '@PSR12' => true ]) ->setFinder($finder) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37f62c9..8ec9254 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ --- +## 2.0.0.0 (2022-07-19) + +- adjust to PHP >= 7.3 and current dependency packages + +--- + ## 1.3.0.0 (2022-07-18) - tests use generated example phone numbers diff --git a/Tests/ClientTest.php b/Tests/ClientTest.php index 8467f4e..d41a36d 100644 --- a/Tests/ClientTest.php +++ b/Tests/ClientTest.php @@ -96,7 +96,7 @@ class ClientTest extends ApiTestCase return [ 'api key only' => ['apiKey', null, null], 'all without client' => ['apiKey', new Url(), null], - 'all arguments' => ['apiKey', new Url(), new GuzzleClient()] + 'all arguments' => ['apiKey', new Url(), new GuzzleClient()], ]; } @@ -167,7 +167,7 @@ class ClientTest extends ApiTestCase { return [ 'request is valid' => [true], - 'request is not valid' => [false] + 'request is not valid' => [false], ]; } @@ -203,7 +203,7 @@ class ClientTest extends ApiTestCase 'withHeader', 'withAddedHeader', 'withoutHeader', - 'withBody' + 'withBody', ]) ->disableOriginalConstructor() ->getMock(); @@ -232,7 +232,7 @@ class ClientTest extends ApiTestCase $clientMock = $this->getMockBuilder(Client::class) ->disableOriginalConstructor() ->onlyMethods([ - 'getLoggerHandler' + 'getLoggerHandler', ]) ->getMock(); $clientMock->expects($this->atLeastOnce()) diff --git a/Tests/RecipientsList/RecipientsListTest.php b/Tests/RecipientsList/RecipientsListTest.php index e62d537..62e8288 100644 --- a/Tests/RecipientsList/RecipientsListTest.php +++ b/Tests/RecipientsList/RecipientsListTest.php @@ -167,7 +167,7 @@ class RecipientsListTest extends ApiTestCase $this->assertSame( [ $this->phoneNumberFixture, - $this->phoneNumberFixture + $this->phoneNumberFixture, ], $this->callMethod( $this->recipientsList, @@ -280,7 +280,7 @@ class RecipientsListTest extends ApiTestCase $this->recipientsList, 'recipients', [ - 'fixture' => new stdClass() + 'fixture' => new stdClass(), ] ); @@ -333,11 +333,11 @@ class RecipientsListTest extends ApiTestCase $recipientMock = $this->getMockBuilder(Recipient::class) ->onlyMethods([ 'get', - 'getCountryCode' + 'getCountryCode', ]) ->setConstructorArgs([ $this->phoneNumberFixture, - $this->phoneCountryFixture + $this->phoneCountryFixture, ]) ->getMock(); $recipientMock->method('get')->willReturn($this->phoneNumberFixture); @@ -347,11 +347,11 @@ class RecipientsListTest extends ApiTestCase $recipientMock2 = $this->getMockBuilder(Recipient::class) ->onlyMethods([ 'get', - 'getCountryCode' + 'getCountryCode', ]) ->setConstructorArgs([ $this->phoneNumberFixture, - $this->phoneCountryFixture + $this->phoneCountryFixture, ]) ->getMock(); $recipientMock2->method('get')->willReturn($this->phoneNumberFixture); @@ -359,7 +359,7 @@ class RecipientsListTest extends ApiTestCase $list = [ 'fixture' => $recipientMock, - 'fixture2' => $recipientMock2 + 'fixture2' => $recipientMock2, ]; $this->setValue( diff --git a/Tests/Request/AbstractRequest.php b/Tests/Request/AbstractRequest.php index 0a81c93..63bbd57 100644 --- a/Tests/Request/AbstractRequest.php +++ b/Tests/Request/AbstractRequest.php @@ -17,6 +17,7 @@ namespace D3\LinkmobilityClient\Tests\Request; use Assert\InvalidArgumentException; use D3\LinkmobilityClient\Client; +use D3\LinkmobilityClient\Exceptions\RecipientException; use D3\LinkmobilityClient\RecipientsList\RecipientsListInterface; use D3\LinkmobilityClient\Request\Request; use D3\LinkmobilityClient\Request\RequestInterface; @@ -24,6 +25,7 @@ use D3\LinkmobilityClient\SMS\Response; use D3\LinkmobilityClient\Tests\ApiTestCase; use D3\LinkmobilityClient\ValueObject\Recipient; use D3\LinkmobilityClient\ValueObject\Sender; +use libphonenumber\NumberParseException; use libphonenumber\PhoneNumberFormat; use libphonenumber\PhoneNumberType; use libphonenumber\PhoneNumberUtil; @@ -115,10 +117,13 @@ abstract class AbstractRequest extends ApiTestCase /** * @test - * @throws ReflectionException * @covers \D3\LinkmobilityClient\SMS\BinaryRequest::validate * @covers \D3\LinkmobilityClient\SMS\TextRequest::validate * @covers \D3\LinkmobilityClient\Request\Request::validate + * @return void + * @throws ReflectionException + * @throws RecipientException + * @throws NumberParseException */ public function validatePassedTest() { @@ -149,9 +154,12 @@ abstract class AbstractRequest extends ApiTestCase /** * @test - * @throws ReflectionException * @covers \D3\LinkmobilityClient\SMS\BinaryRequest::validate * @covers \D3\LinkmobilityClient\SMS\TextRequest::validate + * @return void + * @throws NumberParseException + * @throws RecipientException + * @throws ReflectionException */ public function validateFailedTest() { @@ -253,17 +261,17 @@ abstract class AbstractRequest extends ApiTestCase ['json' => [ 'contentCategory' => 'informational', 'messageContent' => 'messageContent', - 'priority' => 0 - ]] + 'priority' => 0, + ]], ], 'other' => [ 'other', [ 'contentCategory' => 'informational', 'messageContent' => 'messageContent', - 'priority' => 0 - ] - ] + 'priority' => 0, + ], + ], ]; } @@ -284,20 +292,20 @@ abstract class AbstractRequest extends ApiTestCase ['json' => [ 'contentCategory' => 'informational', 'messageContent' => 'messageContent', - 'priority' => 0 + 'priority' => 0, ]] ); $this->assertSame( ['headers' => [ 'Accept' => 'application/json', - 'Content-Type' => 'application/json' + 'Content-Type' => 'application/json', ], 'json' => [ 'contentCategory' => 'informational', 'messageContent' => 'messageContent', - 'priority' => 0 - ]], + 'priority' => 0, + ], ], $this->callMethod( $requestMock, 'getOptions' @@ -671,7 +679,7 @@ abstract class AbstractRequest extends ApiTestCase /** @var StreamInterface|MockObject $streamMock */ $streamMock = $this->getMockBuilder(StreamInterface::class) ->onlyMethods(['getContents', '__toString', 'close', 'detach', 'getSize', 'tell', 'eof', 'isSeekable', - 'seek', 'rewind', 'isWritable', 'write', 'isReadable', 'read', 'getMetadata']) + 'seek', 'rewind', 'isWritable', 'write', 'isReadable', 'read', 'getMetadata', ]) ->getMock(); $streamMock->method('getContents')->willReturn('{}'); @@ -680,12 +688,12 @@ abstract class AbstractRequest extends ApiTestCase ->onlyMethods([ 'getBody', 'getStatusCode', 'withStatus', 'getReasonphrase', 'getProtocolVersion', 'withProtocolVersion', 'getHeaders', 'hasHeader', 'getHeader', 'getHeaderLine', - 'withHeader', 'withAddedHeader', 'withoutHeader', 'withBody']) + 'withHeader', 'withAddedHeader', 'withoutHeader', 'withBody', ]) ->getMock(); $rawResponseMock->method('getBody')->willReturn($streamMock); return [ - 'SMS Response' => [$rawResponseMock] + 'SMS Response' => [$rawResponseMock], ]; } diff --git a/Tests/Response/AbstractResponse.php b/Tests/Response/AbstractResponse.php index e5e7c35..f8c4b7d 100644 --- a/Tests/Response/AbstractResponse.php +++ b/Tests/Response/AbstractResponse.php @@ -38,7 +38,7 @@ abstract class AbstractResponse extends ApiTestCase /** @var StreamInterface|MockObject $streamMock */ $streamMock = $this->getMockBuilder(StreamInterface::class) ->onlyMethods(['getContents', '__toString', 'close', 'detach', 'getSize', 'tell', 'eof', 'isSeekable', - 'seek', 'rewind', 'isWritable', 'write', 'isReadable', 'read', 'getMetadata']) + 'seek', 'rewind', 'isWritable', 'write', 'isReadable', 'read', 'getMetadata', ]) ->getMock(); $streamMock->expects($this->atLeastOnce())->method('getContents')->willReturn( '{ @@ -53,7 +53,7 @@ abstract class AbstractResponse extends ApiTestCase ->onlyMethods([ 'getBody', 'getStatusCode', 'withStatus', 'getReasonphrase', 'getProtocolVersion', 'withProtocolVersion', 'getHeaders', 'hasHeader', 'getHeader', 'getHeaderLine', - 'withHeader', 'withAddedHeader', 'withoutHeader', 'withBody']) + 'withHeader', 'withAddedHeader', 'withoutHeader', 'withBody', ]) ->getMock(); $rawResponseMock->method('getBody')->willReturn($streamMock); @@ -226,7 +226,7 @@ abstract class AbstractResponse extends ApiTestCase { return [ 'successful' => [true, ''], - 'not successful'=> [false, 'fixtureMessage'] + 'not successful'=> [false, 'fixtureMessage'], ]; } } diff --git a/Tests/SMS/RequestFactoryTest.php b/Tests/SMS/RequestFactoryTest.php index ddd6654..9552a5b 100644 --- a/Tests/SMS/RequestFactoryTest.php +++ b/Tests/SMS/RequestFactoryTest.php @@ -100,8 +100,8 @@ class RequestFactoryTest extends ApiTestCase public function getTextSmsRequestDataProvider(): array { return [ - 'binary' => [RequestFactory::GSM_UCS2, BinaryRequest::class], - 'ascii' => [RequestFactory::GSM_7BIT, TextRequest::class] + 'binary' => [SmsLength::ENCODING_UCS2, BinaryRequest::class], + 'ascii' => [SmsLength::ENCODING_7BIT, TextRequest::class], ]; } diff --git a/Tests/ValueObject/RecipientTest.php b/Tests/ValueObject/RecipientTest.php index 5d73941..6be8e9b 100644 --- a/Tests/ValueObject/RecipientTest.php +++ b/Tests/ValueObject/RecipientTest.php @@ -162,7 +162,7 @@ class RecipientTest extends ApiTestCase 'invalid country code' => [$phoneNumberFixture, 'DEX', true, PhoneNumberType::MOBILE, InvalidArgumentException::class], 'unparsable' => ['abc', 'DE', true, PhoneNumberType::MOBILE, NumberParseException::class], 'invalid number' => ['abcd', 'DE', false, PhoneNumberType::MOBILE, RecipientException::class], - 'not mobile number' => ['abcd', 'DE', true, PhoneNumberType::FIXED_LINE, RecipientException::class] + 'not mobile number' => ['abcd', 'DE', true, PhoneNumberType::FIXED_LINE, RecipientException::class], ]; } diff --git a/Tests/ValueObject/SenderTest.php b/Tests/ValueObject/SenderTest.php index 860f4ae..f4f6bdb 100644 --- a/Tests/ValueObject/SenderTest.php +++ b/Tests/ValueObject/SenderTest.php @@ -16,7 +16,6 @@ declare(strict_types=1); namespace D3\LinkmobilityClient\Tests\ValueObject; use Assert\InvalidArgumentException; -use D3\LinkmobilityClient\Exceptions\NoSenderDefinedException; use D3\LinkmobilityClient\Exceptions\RecipientException; use D3\LinkmobilityClient\Tests\ApiTestCase; use D3\LinkmobilityClient\ValueObject\Sender; @@ -112,7 +111,7 @@ class SenderTest extends ApiTestCase return [ 'null number' => [null, $this->phoneCountryFixture, false], 'null country' => [$this->phoneNumberFixture, null, false], - 'all values' => [$this->phoneNumberFixture, $this->phoneCountryFixture, true] + 'all values' => [$this->phoneNumberFixture, $this->phoneCountryFixture, true], ]; } @@ -122,11 +121,9 @@ class SenderTest extends ApiTestCase * @param $country * @param $validNumber * @param $expectedException - * - * @throws NumberParseException - * @throws RecipientException + * @throws ReflectionException * @dataProvider constructInvalidDataProvider - * @covers \D3\LinkmobilityClient\ValueObject\Sender::__construct + * @covers \D3\LinkmobilityClient\ValueObject\Sender::__construct */ public function testConstructInvalid($number, $country, $validNumber, $expectedException) { @@ -174,7 +171,7 @@ class SenderTest extends ApiTestCase 'empty number' => ['', 'DE', true, InvalidArgumentException::class], 'invalid country code' => [$phoneNumberFixture, 'DEX', true, InvalidArgumentException::class], 'unparsable' => ['abc', 'DE', true, NumberParseException::class], - 'invalid number' => ['abcd', 'DE', false, RecipientException::class] + 'invalid number' => ['abcd', 'DE', false, RecipientException::class], ]; } diff --git a/Tests/ValueObject/SmsBinaryMessageTest.php b/Tests/ValueObject/SmsBinaryMessageTest.php index a45aee1..8772dd8 100644 --- a/Tests/ValueObject/SmsBinaryMessageTest.php +++ b/Tests/ValueObject/SmsBinaryMessageTest.php @@ -131,7 +131,7 @@ class SmsBinaryMessageTest extends ApiTestCase { return [ 'empty message' => ['', true, InvalidArgumentException::class], - 'invalid sms message' => ['abc', false, \Phlib\SmsLength\Exception\InvalidArgumentException::class] + 'invalid sms message' => ['abc', false, \Phlib\SmsLength\Exception\InvalidArgumentException::class], ]; } diff --git a/Tests/ValueObject/ValueObjectTest.php b/Tests/ValueObject/ValueObjectTest.php index f9ef1ed..f7e513b 100644 --- a/Tests/ValueObject/ValueObjectTest.php +++ b/Tests/ValueObject/ValueObjectTest.php @@ -16,13 +16,8 @@ declare(strict_types=1); namespace D3\LinkmobilityClient\Tests\ValueObject; use Assert\InvalidArgumentException; -use D3\LinkmobilityClient\Exceptions\NoSenderDefinedException; -use D3\LinkmobilityClient\Exceptions\RecipientException; use D3\LinkmobilityClient\Tests\ApiTestCase; -use D3\LinkmobilityClient\ValueObject\Sender; use D3\LinkmobilityClient\ValueObject\ValueObject; -use libphonenumber\NumberParseException; -use libphonenumber\PhoneNumber; use libphonenumber\PhoneNumberFormat; use libphonenumber\PhoneNumberType; use libphonenumber\PhoneNumberUtil; diff --git a/composer.json b/composer.json index 1508f0e..1848b0c 100644 --- a/composer.json +++ b/composer.json @@ -21,18 +21,18 @@ "GPL-3.0-or-later" ], "require": { - "php": "^7.0 || ^8.0", - "beberlei/assert": "^2.9.9", - "guzzlehttp/guzzle": "~6.2 || ^7.4", + "php": "^7.3 || ^8.0", + "beberlei/assert": "^3.3", + "guzzlehttp/guzzle": "^7.4", "psr/http-message": "~1.0", - "phlib/sms-length": "^1.1.0 || ^2.0.0", + "phlib/sms-length": "^2.0", "giggsey/libphonenumber-for-php": "^8.12.50", "ext-json": "*" }, "require-dev": { - "php": "^7.2", - "phpunit/phpunit" : "^8.0", - "friendsofphp/php-cs-fixer": "^2.0" + "php": "^7.4", + "phpunit/phpunit" : "^9.5", + "friendsofphp/php-cs-fixer": "^3.9" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 4ffb4a9..3331a08 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,22 +1,20 @@ - - - - - ./Tests - - - - - src - - - - - - - + + + + + src + + + + + + + ./Tests + + diff --git a/src/LoggerHandler.php b/src/LoggerHandler.php index a79794c..26b74d7 100644 --- a/src/LoggerHandler.php +++ b/src/LoggerHandler.php @@ -23,7 +23,7 @@ class LoggerHandler private static $instance = null; private $logger; - public static function getInstance() + public static function getInstance(): ?LoggerHandler { if (self::$instance === null) { self::$instance = new self(); diff --git a/src/Request/Request.php b/src/Request/Request.php index aef637f..94dcdd9 100644 --- a/src/Request/Request.php +++ b/src/Request/Request.php @@ -169,7 +169,7 @@ abstract class Request implements RequestInterface 'senderAddress' => $this->getSenderAddress() ? $this->getSenderAddress()->getFormatted() : null, 'senderAddressType' => $this->getSenderAddressType(), 'test' => $this->getTestMode(), - 'validityPeriode' => $this->getValidityPeriode() + 'validityPeriode' => $this->getValidityPeriode(), ]; } @@ -200,7 +200,7 @@ abstract class Request implements RequestInterface 'headers' => [ 'Accept' => $this->contentType, 'Content-Type' => $this->contentType, - ] + ], ], $this->getBody() ); @@ -280,7 +280,7 @@ abstract class Request implements RequestInterface return $this; } - public function getClientMessageId() + public function getClientMessageId(): ?string { return $this->clientMessageId; } @@ -306,7 +306,7 @@ abstract class Request implements RequestInterface { return [ RequestInterface::CONTENTCATEGORY_ADVERTISEMENT => RequestInterface::CONTENTCATEGORY_ADVERTISEMENT, - RequestInterface::CONTENTCATEGORY_INFORMATIONAL => RequestInterface::CONTENTCATEGORY_INFORMATIONAL + RequestInterface::CONTENTCATEGORY_INFORMATIONAL => RequestInterface::CONTENTCATEGORY_INFORMATIONAL, ]; } @@ -376,7 +376,7 @@ abstract class Request implements RequestInterface /** * @return string|null */ - public function getNotificationCallbackUrl() + public function getNotificationCallbackUrl(): ?string { return $this->notificationCallbackUrl; } @@ -396,7 +396,7 @@ abstract class Request implements RequestInterface /** * @return int|null */ - public function getPriority() + public function getPriority(): ?int { return $this->priority; } @@ -444,7 +444,7 @@ abstract class Request implements RequestInterface /** * @return Sender|null */ - public function getSenderAddress() + public function getSenderAddress(): ?Sender { return $this->senderAddress; } @@ -464,7 +464,7 @@ abstract class Request implements RequestInterface /** * @return string|null */ - public function getSenderAddressType() + public function getSenderAddressType(): ?string { return $this->getSenderAddress() && $this->getSenderAddress()->get() ? $this->senderAddressType : null; } @@ -478,7 +478,7 @@ abstract class Request implements RequestInterface RequestInterface::SENDERADDRESSTYPE_ALPHANUMERIC => RequestInterface::SENDERADDRESSTYPE_ALPHANUMERIC, RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL => RequestInterface::SENDERADDRESSTYPE_INTERNATIONAL, RequestInterface::SENDERADDRESSTYPE_NATIONAL => RequestInterface::SENDERADDRESSTYPE_NATIONAL, - RequestInterface::SENDERADDRESSTYPE_SHORTCODE => RequestInterface::SENDERADDRESSTYPE_SHORTCODE + RequestInterface::SENDERADDRESSTYPE_SHORTCODE => RequestInterface::SENDERADDRESSTYPE_SHORTCODE, ]; } @@ -497,7 +497,7 @@ abstract class Request implements RequestInterface /** * @return int|null */ - public function getValidityPeriode() + public function getValidityPeriode(): ?int { return $this->validityPeriode; } @@ -523,6 +523,7 @@ abstract class Request implements RequestInterface /** * @param Client $client + * @return Request */ public function setClient(Client $client): Request { diff --git a/src/Response/Response.php b/src/Response/Response.php index 255515f..1716a8c 100644 --- a/src/Response/Response.php +++ b/src/Response/Response.php @@ -72,7 +72,7 @@ abstract class Response implements ResponseInterface /** * @return string|null */ - public function getClientMessageId() + public function getClientMessageId(): ?string { return $this->getContent()[self::CLIENTMESSAGEID]; } @@ -80,13 +80,13 @@ abstract class Response implements ResponseInterface /** * @return string|null */ - public function getTransferId() + public function getTransferId(): ?string { return $this->getContent()[self::TRANSFERID]; } /** - * @return string|null + * @return int */ public function getSmsCount(): int { diff --git a/src/SMS/BinaryRequest.php b/src/SMS/BinaryRequest.php index bc53810..6895224 100644 --- a/src/SMS/BinaryRequest.php +++ b/src/SMS/BinaryRequest.php @@ -36,7 +36,7 @@ class BinaryRequest extends Request implements SmsRequestInterface return array_merge( parent::getRawBody(), [ - 'userDataHeaderPresent' => true + 'userDataHeaderPresent' => true, ] ); } diff --git a/src/SMS/RequestFactory.php b/src/SMS/RequestFactory.php index d98b3b3..5587d5e 100644 --- a/src/SMS/RequestFactory.php +++ b/src/SMS/RequestFactory.php @@ -20,21 +20,15 @@ use D3\LinkmobilityClient\ValueObject\SmsBinaryMessage; use D3\LinkmobilityClient\ValueObject\SmsTextMessage; use Phlib\SmsLength\SmsLength; -class RequestFactory +class RequestFactory implements RequestFactoryInterface { - /** - * @deprecated is SmsLength constant from version 2.1 - */ - public const GSM_7BIT = '7-bit'; - - /** - * @deprecated is SmsLength constant from version 2.1 - */ - public const GSM_UCS2 = 'ucs-2'; - protected $message; protected $client; + /** + * @param $message + * @param Client $client + */ public function __construct($message, Client $client) { $this->message = $message; @@ -46,7 +40,7 @@ class RequestFactory */ public function getSmsRequest(): SmsRequestInterface { - if ($this->getSmsLength()->getEncoding() === self::GSM_7BIT) { + if ($this->getSmsLength()->getEncoding() === SmsLength::ENCODING_7BIT) { $message = new SmsTextMessage($this->message); return new TextRequest($message, $this->client); } diff --git a/src/SMS/RequestFactoryInterface.php b/src/SMS/RequestFactoryInterface.php index 9cd5b46..0336aee 100644 --- a/src/SMS/RequestFactoryInterface.php +++ b/src/SMS/RequestFactoryInterface.php @@ -15,9 +15,11 @@ declare(strict_types=1); namespace D3\LinkmobilityClient\SMS; +use D3\LinkmobilityClient\Client; + interface RequestFactoryInterface { - public function __construct($message); + public function __construct($message, Client $client); - public function getRequest(): SmsRequestInterface; + public function getSmsRequest(): SmsRequestInterface; } diff --git a/src/SMS/Response.php b/src/SMS/Response.php index 6a43a2f..5147699 100644 --- a/src/SMS/Response.php +++ b/src/SMS/Response.php @@ -15,6 +15,8 @@ declare(strict_types=1); namespace D3\LinkmobilityClient\SMS; -class Response extends \D3\LinkmobilityClient\Response\Response +use D3\LinkmobilityClient\Response\Response as BaseResponse; + +class Response extends BaseResponse { } diff --git a/src/Url/Url.php b/src/Url/Url.php index bf91514..c1d5c83 100644 --- a/src/Url/Url.php +++ b/src/Url/Url.php @@ -30,7 +30,7 @@ class Url implements UrlInterface /** * @return string */ - public function getTextSmsUri() + public function getTextSmsUri(): string { return '/rest/smsmessaging/text'; } @@ -38,7 +38,7 @@ class Url implements UrlInterface /** * @return string */ - public function getBinarySmsUri() + public function getBinarySmsUri(): string { return '/rest/smsmessaging/binary'; } diff --git a/src/Url/UrlInterface.php b/src/Url/UrlInterface.php index 4700851..2ed562b 100644 --- a/src/Url/UrlInterface.php +++ b/src/Url/UrlInterface.php @@ -18,4 +18,8 @@ namespace D3\LinkmobilityClient\Url; interface UrlInterface { public function getBaseUri(): string; + + public function getTextSmsUri(): string; + + public function getBinarySmsUri(): string; } diff --git a/src/ValueObject/Recipient.php b/src/ValueObject/Recipient.php index d6473e1..2ec1115 100644 --- a/src/ValueObject/Recipient.php +++ b/src/ValueObject/Recipient.php @@ -30,7 +30,7 @@ class Recipient extends StringValueObject */ protected $allowedNumberTypes = [ PhoneNumberType::MOBILE, - PhoneNumberType::FIXED_LINE_OR_MOBILE + PhoneNumberType::FIXED_LINE_OR_MOBILE, ]; /** @@ -86,7 +86,7 @@ class Recipient extends StringValueObject return $this->countryCode; } - public function getFormatted() + public function getFormatted(): string { return ltrim(parent::getFormatted(), '+'); } diff --git a/src/ValueObject/Sender.php b/src/ValueObject/Sender.php index a84c979..7b36c72 100644 --- a/src/ValueObject/Sender.php +++ b/src/ValueObject/Sender.php @@ -27,11 +27,11 @@ use libphonenumber\PhoneNumberUtil; class Sender extends ValueObject { /** - * @param string $number - * @param string $iso2CountryCode + * @param string|null $number + * @param string|null $iso2CountryCode * - * @throws RecipientException * @throws NumberParseException + * @throws RecipientException */ public function __construct(string $number = null, string $iso2CountryCode = null) { @@ -67,7 +67,7 @@ class Sender extends ValueObject return PhoneNumberUtil::getInstance(); } - public function getFormatted() + public function getFormatted(): string { return ltrim(parent::getFormatted(), '+'); } diff --git a/src/ValueObject/SmsMessageAbstract.php b/src/ValueObject/SmsMessageAbstract.php index 7701b78..72ec222 100644 --- a/src/ValueObject/SmsMessageAbstract.php +++ b/src/ValueObject/SmsMessageAbstract.php @@ -43,6 +43,9 @@ abstract class SmsMessageAbstract extends StringValueObject implements SmsMessag return $this->getSmsLength()->getSize(); } + /** + * @return mixed + */ public function getMessageContent() { return $this->get(); diff --git a/src/ValueObject/StringValueObject.php b/src/ValueObject/StringValueObject.php index a0e58c2..47b240b 100644 --- a/src/ValueObject/StringValueObject.php +++ b/src/ValueObject/StringValueObject.php @@ -15,8 +15,6 @@ declare(strict_types=1); namespace D3\LinkmobilityClient\ValueObject; -use Assert\Assert; - abstract class StringValueObject extends ValueObject { public function __toString() diff --git a/src/ValueObject/ValueObject.php b/src/ValueObject/ValueObject.php index 5a24217..e537d1f 100644 --- a/src/ValueObject/ValueObject.php +++ b/src/ValueObject/ValueObject.php @@ -33,7 +33,7 @@ abstract class ValueObject return $this->value; } - public function getFormatted() + public function getFormatted(): string { return $this->get(); }