beautify code

This commit is contained in:
Daniel Seifert 2022-07-14 12:07:18 +02:00
parent aa88f09e16
commit 7e67bc1818
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
8 changed files with 14 additions and 17 deletions

View File

@ -70,10 +70,10 @@ class LoggerHandlerTest extends ApiTestCase
->onlyMethods(['debug', 'error', 'log'])
->getMock();
$this->callMethod( $this->loggerHandler, 'setLogger', [ $loggerMock]);
$this->callMethod($this->loggerHandler, 'setLogger', [ $loggerMock]);
$this->assertSame(
$loggerMock,
$this->callMethod( $this->loggerHandler, 'getLogger')
$this->callMethod($this->loggerHandler, 'getLogger')
);
}
}

View File

@ -477,7 +477,7 @@ abstract class AbstractRequest extends ApiTestCase
if ($hasSender) {
/** @var Sender|MockObject $senderMock */
$senderMock = $this->getMockBuilder( Sender::class )
$senderMock = $this->getMockBuilder(Sender::class)
->disableOriginalConstructor()
->onlyMethods(['get'])
->getMock();

View File

@ -24,7 +24,6 @@ use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\GuzzleException;
use InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface;
class Client
{

View File

@ -17,5 +17,4 @@ namespace D3\LinkmobilityClient\Exceptions;
class NoSenderDefinedException extends LinkmobilityException
{
}
}

View File

@ -48,8 +48,8 @@ class LoggerHandler
/**
* @return LoggerInterface
*/
public function getLogger() : LoggerInterface
public function getLogger(): LoggerInterface
{
return $this->logger;
}
}
}

View File

@ -18,7 +18,6 @@ namespace D3\LinkmobilityClient\RecipientsList;
use D3\LinkmobilityClient\Client;
use D3\LinkmobilityClient\Exceptions\ExceptionMessages;
use D3\LinkmobilityClient\Exceptions\RecipientException;
use D3\LinkmobilityClient\LoggerHandler;
use D3\LinkmobilityClient\ValueObject\Recipient;
use Iterator;
use libphonenumber\NumberParseException;

View File

@ -126,7 +126,7 @@ abstract class Request implements RequestInterface
/**
* @return string
*/
public abstract function getUri(): string;
abstract public function getUri(): string;
/**
* @throws InvalidArgumentException

View File

@ -36,22 +36,22 @@ class Sender extends StringValueObject
public function __construct(string $number = null, string $iso2CountryCode = null)
{
try {
if ( is_null( $number ) || is_null( $iso2CountryCode ) ) {
if (is_null($number) || is_null($iso2CountryCode)) {
throw new NoSenderDefinedException();
}
Assert::that( $iso2CountryCode )->string()->length( 2 );
Assert::that($iso2CountryCode)->string()->length(2);
$phoneUtil = $this->getPhoneNumberUtil();
$phoneNumber = $phoneUtil->parse( $number, strtoupper( $iso2CountryCode ) );
$number = ltrim( $phoneUtil->format( $phoneNumber, PhoneNumberFormat::E164 ), '+' );
$phoneNumber = $phoneUtil->parse($number, strtoupper($iso2CountryCode));
$number = ltrim($phoneUtil->format($phoneNumber, PhoneNumberFormat::E164), '+');
if ( false === $phoneUtil->isValidNumber( $phoneNumber ) ) {
throw new RecipientException( ExceptionMessages::INVALID_SENDER );
if (false === $phoneUtil->isValidNumber($phoneNumber)) {
throw new RecipientException(ExceptionMessages::INVALID_SENDER);
}
parent::__construct( $number );
parent::__construct($number);
} catch (NoSenderDefinedException $e) {
LoggerHandler::getInstance()->getLogger()->debug(
ExceptionMessages::DEBUG_NOSENDERORCOUNTRYCODE