Skip to content

Commit

Permalink
style: run rector
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Dec 28, 2024
1 parent 7a7c588 commit 24f83e4
Show file tree
Hide file tree
Showing 67 changed files with 136 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
abstract class AbstractRequestDataMapper implements RequestDataMapperInterface
{
protected EventDispatcherInterface $eventDispatcher;

protected RequestValueMapperInterface $valueMapper;

protected RequestValueFormatterInterface $valueFormatter;

protected CryptInterface $crypt;

protected bool $testMode = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ public function formatCardExpDate(\DateTimeInterface $expDate, string $fieldName
*/
public function formatDateTime(\DateTimeInterface $dateTime, string $fieldName = null, string $txType = null): string
{
if (PosInterface::TX_TYPE_HISTORY === $txType && ('StartDate' === $fieldName || 'EndDate' === $fieldName)) {
return $dateTime->format('d/m/Y H:i');
}

return $dateTime->format('d/m/Y H:i');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function formatDateTime(\DateTimeInterface $dateTime, string $fieldName =
if ('timeSpan' === $fieldName) {
return $dateTime->format('YmdHis');
}

if ('transactionDate' === $fieldName) {
return $dateTime->format('Ymd');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getSecureTypeMappings(): array
*/
public function mapSecureType(string $paymentModel): string
{
if (0 === count($this->secureTypeMappings)) {
if ([] === $this->secureTypeMappings) {
throw new \LogicException('Security type mappings are not supported.');
}

Expand Down Expand Up @@ -120,7 +120,7 @@ public function getRecurringOrderFrequencyMappings(): array
*/
public function mapRecurringFrequency(string $period): string
{
if (0 === count($this->recurringOrderFrequencyMappings)) {
if ([] === $this->recurringOrderFrequencyMappings) {
throw new \LogicException('Recurring frequency mappings are not supported.');
}

Expand All @@ -132,7 +132,7 @@ public function mapRecurringFrequency(string $period): string
*/
public function mapLang(string $lang): string
{
if (0 === count($this->langMappings)) {
if ([] === $this->langMappings) {
throw new \LogicException('Language mappings are not supported.');
}

Expand Down Expand Up @@ -160,7 +160,7 @@ public function getCardTypeMappings(): array
*/
public function mapCardType(string $cardType): string
{
if (0 === count($this->cardTypeMappings)) {
if ([] === $this->cardTypeMappings) {
throw new \LogicException('Card type mappings are not supported.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ private function mapSingleOrderHistoryTransaction(array $rawTx): array
if (null !== $transTime) {
$defaultResponse['transaction_time'] = $this->valueFormatter->formatDateTime($transTime, $txType);
}

$defaultResponse['capture_time'] = null !== $rawTx['AuthDate'] ? $this->valueFormatter->formatDateTime($rawTx['AuthDate'], $txType) : null;
$amount = $rawTx['AuthAmount'];
$defaultResponse['capture_amount'] = null !== $amount ? $this->valueFormatter->formatAmount($amount, $txType) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ public function formatInstallment(?string $installment, string $txType): int
return 0;
}

if (PosInterface::TX_TYPE_HISTORY === $txType) {
// history response
if ('Pesin' === $installment || '1' === $installment) {
return 0;
}
// history response
if (PosInterface::TX_TYPE_HISTORY === $txType && ('Pesin' === $installment || '1' === $installment)) {
return 0;
}

return parent::formatInstallment($installment, $txType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(
if ([] !== $txTypeMappings) {
$this->txTypeMappings = $txTypeMappings;
}

if ([] !== $secureTypeMappings) {
$this->secureTypeMappings = \array_flip($secureTypeMappings);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class AkbankPosRequestDataMapperTest extends TestCase
private array $order;

private EventDispatcherInterface $dispatcher;

private AkbankPosRequestValueFormatter $valueFormatter;

private AkbankPosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class EstPosRequestDataMapperTest extends TestCase

/** @var EventDispatcherInterface & MockObject */
private EventDispatcherInterface $dispatcher;

private EstPosRequestValueFormatter $valueFormatter;

private EstPosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ class EstV3PosRequestDataMapperTest extends TestCase

/** @var EventDispatcherInterface & MockObject */
private EventDispatcherInterface $dispatcher;

private EstPosRequestValueFormatter $valueFormatter;

private EstPosRequestValueMapper $valueMapper;

protected function setUp(): void
{
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class GarantiPosRequestDataMapperTest extends TestCase
private CryptInterface $crypt;

private GarantiPosRequestValueFormatter $valueFormatter;

private GarantiPosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class InterPosRequestDataMapperTest extends TestCase
private EventDispatcherInterface $dispatcher;

private InterPosRequestValueFormatter $valueFormatter;

private InterPosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class KuveytPosRequestDataMapperTest extends TestCase
private EventDispatcherInterface $dispatcher;

private KuveytPosRequestValueFormatter $valueFormatter;

private KuveytPosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PayFlexCPV4PosRequestDataMapperTest extends TestCase
private CryptInterface $crypt;

private PayFlexCPV4PosRequestValueFormatter $valueFormatter;

private PayFlexCPV4PosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PayFlexV4PosRequestDataMapperTest extends TestCase
private EventDispatcherInterface $dispatcher;

private PayFlexV4PosRequestValueFormatter $valueFormatter;

private PayFlexV4PosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class PayForPosRequestDataMapperTest extends TestCase

/** @var EventDispatcherInterface & MockObject */
private EventDispatcherInterface $dispatcher;

private PayForPosRequestValueFormatter $valueFormatter;

private PayForPosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class PosNetRequestDataMapperTest extends TestCase
private CryptInterface $crypt;

private PosNetRequestValueFormatter $valueFormatter;

private PosNetRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PosNetV1PosRequestDataMapperTest extends TestCase
private CryptInterface $crypt;

private PosNetV1PosRequestValueFormatter $valueFormatter;

private PosNetV1PosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ToslaPosRequestDataMapperTest extends TestCase
private ToslaPosRequestDataMapper $requestDataMapper;

private ToslaPosRequestValueFormatter $valueFormatter;

private ToslaPosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class VakifKatilimPosRequestDataMapperTest extends TestCase
private CryptInterface $crypt;

private VakifKatilimPosRequestValueFormatter $valueFormatter;

private VakifKatilimPosRequestValueMapper $valueMapper;

protected function setUp(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
* [1, 1]
* [2, 2]
*/
public function testFormatInstallment($installment, int $expected): void
public function testFormatInstallment(int $installment, int $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
* [1, ""]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
* [1, ""]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
* [1, ""]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
* [1, "0"]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
* [1, "0"]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
* [1, "0"]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function setUp(): void
* [1, "0"]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function setUp(): void
* [2, "02"]
* [12, "12"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function setUp(): void
* [1, "0"]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function setUp(): void
* [1, 0]
* [2, 2]
*/
public function testFormatInstallment($installment, int $expected): void
public function testFormatInstallment(int $installment, int $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down Expand Up @@ -78,7 +78,7 @@ public function testFormatDateTime(?string $fieldName, string $expected): void
* [null]
* [""]
*/
public function testFormatDateTimeUnsupportedField($fieldName): void
public function testFormatDateTimeUnsupportedField(?string $fieldName): void
{
$dateTime = new \DateTime('2024-04-14T16:45:30.000');
$this->expectException(\InvalidArgumentException::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
* [1, "0"]
* [2, "2"]
*/
public function testFormatInstallment($installment, string $expected): void
public function testFormatInstallment(int $installment, string $expected): void
{
$actual = $this->formatter->formatInstallment($installment);
$this->assertSame($expected, $actual);
Expand Down Expand Up @@ -79,7 +79,7 @@ public function testFormatDateTime(\DateTimeInterface $dateTime, ?string $fieldN
* [null]
* [""]
*/
public function testFormatDateTimeUnsupportedField($fieldName): void
public function testFormatDateTimeUnsupportedField(?string $fieldName): void
{
$dateTime = new \DateTime('2024-04-14T16:45:30.000');
$this->expectException(\InvalidArgumentException::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AkbankPosRequestValueMapperTest extends TestCase

private AkbankPosRequestValueMapper $valueMapper;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();
$this->valueMapper = new AkbankPosRequestValueMapper();
Expand Down Expand Up @@ -96,7 +96,7 @@ public function testGetTxTypeMappings(): void
$this->assertCount(8, $this->valueMapper->getTxTypeMappings());
}

public function testGetSecureTypeMappings()
public function testGetSecureTypeMappings(): void
{
$this->assertCount(4, $this->valueMapper->getSecureTypeMappings());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class EstPosRequestValueMapperTest extends TestCase
{
private EstPosRequestValueMapper $valueMapper;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();
$this->valueMapper = new EstPosRequestValueMapper();
Expand Down Expand Up @@ -95,7 +95,7 @@ public function testGetTxTypeMappings(): void
$this->assertCount(8, $this->valueMapper->getTxTypeMappings());
}

public function testGetSecureTypeMappings()
public function testGetSecureTypeMappings(): void
{
$this->assertCount(5, $this->valueMapper->getSecureTypeMappings());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GarantiPosRequestValueMapperTest extends TestCase
{
private GarantiPosRequestValueMapper $valueMapper;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();
$this->valueMapper = new GarantiPosRequestValueMapper();
Expand Down Expand Up @@ -95,7 +95,7 @@ public function testGetTxTypeMappings(): void
$this->assertCount(9, $this->valueMapper->getTxTypeMappings());
}

public function testGetSecureTypeMappings()
public function testGetSecureTypeMappings(): void
{
$this->assertCount(2, $this->valueMapper->getSecureTypeMappings());
}
Expand Down
Loading

0 comments on commit 24f83e4

Please sign in to comment.