beautify code
This commit is contained in:
parent
aa88f09e16
commit
7e67bc1818
@ -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')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -24,7 +24,6 @@ use GuzzleHttp\ClientInterface;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Client
|
||||
{
|
||||
|
@ -17,5 +17,4 @@ namespace D3\LinkmobilityClient\Exceptions;
|
||||
|
||||
class NoSenderDefinedException extends LinkmobilityException
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ class LoggerHandler
|
||||
/**
|
||||
* @return LoggerInterface
|
||||
*/
|
||||
public function getLogger() : LoggerInterface
|
||||
public function getLogger(): LoggerInterface
|
||||
{
|
||||
return $this->logger;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -126,7 +126,7 @@ abstract class Request implements RequestInterface
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public abstract function getUri(): string;
|
||||
abstract public function getUri(): string;
|
||||
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user