Skip to content

Commit

Permalink
[TASK] Change rector configuration and run
Browse files Browse the repository at this point in the history
Relates: #530
  • Loading branch information
extcode committed Jun 10, 2024
1 parent d2c8a9b commit 4a457ba
Show file tree
Hide file tree
Showing 85 changed files with 344 additions and 738 deletions.
17 changes: 4 additions & 13 deletions Classes/Controller/Backend/Order/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,10 @@

class DocumentController extends ActionController
{
protected PersistenceManager $persistenceManager;

protected ItemRepository $itemRepository;

public function injectPersistenceManager(PersistenceManager $persistenceManager): void
{
$this->persistenceManager = $persistenceManager;
}

public function injectItemRepository(ItemRepository $itemRepository): void
{
$this->itemRepository = $itemRepository;
}
public function __construct(
protected readonly PersistenceManager $persistenceManager,
protected readonly ItemRepository $itemRepository
) {}

public function createAction(Item $orderItem, string $pdfType): ResponseInterface
{
Expand Down
30 changes: 5 additions & 25 deletions Classes/Controller/Backend/Order/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,16 @@ class OrderController extends ActionController
{
private const LANG_FILE = 'LLL:EXT:cart/Resources/Private/Language/locallang.xlf:';

protected PersistenceManager $persistenceManager;

private ModuleTemplate $moduleTemplate;

protected ItemRepository $itemRepository;

protected array $searchArguments = [];

private PageRenderer $pageRenderer;

public function injectPersistenceManager(PersistenceManager $persistenceManager): void
{
$this->persistenceManager = $persistenceManager;
}

public function injectItemRepository(ItemRepository $itemRepository): void
{
$this->itemRepository = $itemRepository;
}

public function injectPageRenderer(PageRenderer $pageRenderer): void
{
$this->pageRenderer = $pageRenderer;
}

public function __construct(
protected readonly ModuleTemplateFactory $moduleTemplateFactory,
protected readonly IconFactory $iconFactory
protected readonly IconFactory $iconFactory,
protected readonly PersistenceManager $persistenceManager,
protected readonly ItemRepository $itemRepository,
private readonly PageRenderer $pageRenderer
) {}

protected function initializeAction(): void
Expand Down Expand Up @@ -133,9 +115,7 @@ public function exportAction(): ResponseInterface
->withBody($this->streamFactory->createStream($this->view->render()));
}

/**
* @IgnoreValidation("orderItem")
*/
#[IgnoreValidation(['value' => 'orderItem'])]
public function showAction(Item $orderItem): ResponseInterface
{
$this->moduleTemplate = $this->moduleTemplateFactory->create($this->request);
Expand Down
8 changes: 2 additions & 6 deletions Classes/Controller/Backend/Order/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@

class PaymentController extends ActionController
{
protected PaymentRepository $paymentRepository;

public function __construct(
PaymentRepository $paymentRepository
) {
$this->paymentRepository = $paymentRepository;
}
protected PaymentRepository $paymentRepository
) {}

public function updateAction(Payment $payment): ResponseInterface
{
Expand Down
8 changes: 2 additions & 6 deletions Classes/Controller/Backend/Order/ShippingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@

class ShippingController extends ActionController
{
protected ShippingRepository $shippingRepository;

public function __construct(
ShippingRepository $shippingRepository
) {
$this->shippingRepository = $shippingRepository;
}
protected ShippingRepository $shippingRepository
) {}

public function updateAction(Shipping $shipping): ResponseInterface
{
Expand Down
12 changes: 2 additions & 10 deletions Classes/Controller/Cart/ActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Extcode\Cart\Utility\CartUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;

class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
abstract class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
protected SessionHandler $sessionHandler;

Expand Down Expand Up @@ -52,15 +52,7 @@ public function injectPaymentMethodsService(PaymentMethodsServiceInterface $paym
$this->paymentMethodsService = $paymentMethodsService;
}

public function injectShippingMethodsService(ShippingMethodsServiceInterface $shippingMethodsService): void
{
$this->shippingMethodsService = $shippingMethodsService;
}

public function injectSpecialOptionsService(SpecialOptionsServiceInterface $specialOptionsService): void
{
$this->specialOptionsService = $specialOptionsService;
}
public function injectShippingMethodsService(ShippingMethodsServiceInterface $shippingMethodsService): void {}

public function initializeAction(): void
{
Expand Down
9 changes: 3 additions & 6 deletions Classes/Controller/Cart/CouponController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@

class CouponController extends ActionController
{
protected CouponRepository $couponRepository;

public function injectCouponRepository(CouponRepository $couponRepository): void
{
$this->couponRepository = $couponRepository;
}
public function __construct(
protected CouponRepository $couponRepository
) {}

public function addAction(): ResponseInterface
{
Expand Down
9 changes: 3 additions & 6 deletions Classes/Controller/Cart/CurrencyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ class CurrencyController extends ActionController
public const AJAX_CART_TYPE_NUM = '2278001';
public const AJAX_CURRENCY_TYPE_NUM = '2278003';

protected CurrencyUtility $currencyUtility;

public function injectCurrencyUtility(CurrencyUtility $currencyUtility): void
{
$this->currencyUtility = $currencyUtility;
}
public function __construct(
protected CurrencyUtility $currencyUtility
) {}

public function updateAction(): ResponseInterface
{
Expand Down
6 changes: 2 additions & 4 deletions Classes/Controller/Cart/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public function initializeCreateAction(): void
}
}

/**
* @IgnoreValidation("shippingAddress")
*/
#[IgnoreValidation(['value' => 'shippingAddress'])]
public function createAction(
Item $orderItem = null,
BillingAddress $billingAddress = null,
Expand Down Expand Up @@ -213,7 +211,7 @@ protected function dispatchOrderCreateEvents(Item $orderItem): bool

$onlyGenerateNumberOfType = [];
if (!empty($this->configurations['autoGenerateNumbers'])) {
$onlyGenerateNumberOfType = array_map('trim', explode(',', $this->configurations['autoGenerateNumbers']));
$onlyGenerateNumberOfType = array_map('trim', explode(',', (string)$this->configurations['autoGenerateNumbers']));
}
$generateNumbersEvent = new NumberGeneratorEvent($this->cart, $orderItem, $this->configurations);
$generateNumbersEvent->setOnlyGenerateNumberOfType($onlyGenerateNumberOfType);
Expand Down
12 changes: 2 additions & 10 deletions Classes/Controller/Order/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,12 @@

class OrderController extends ActionController
{
protected ItemRepository $itemRepository;

protected array $searchArguments = [];
protected array $pluginSettings;

public function injectItemRepository(ItemRepository $itemRepository): void
{
$this->itemRepository = $itemRepository;
}

public function __construct(
private readonly Context $context,
protected ItemRepository $itemRepository
) {}

protected function initializeAction(): void
Expand Down Expand Up @@ -74,9 +68,7 @@ public function listAction(int $currentPage = 1): ResponseInterface
return $this->htmlResponse();
}

/**
* @IgnoreValidation("orderItem")
*/
#[IgnoreValidation(['value' => 'orderItem'])]
public function showAction(Item $orderItem): ResponseInterface
{
$feUserUid = $this->context->getPropertyFromAspect('frontend.user', 'id');
Expand Down
29 changes: 6 additions & 23 deletions Classes/Domain/Finisher/Form/AddToCartFinisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,16 @@

class AddToCartFinisher extends AbstractFinisher
{
protected EventDispatcherInterface $eventDispatcher;

protected SessionHandler $sessionHandler;

protected Cart $cart;

protected CartUtility $cartUtility;

protected array $configurations;

public function injectSessionHandler(SessionHandler $sessionHandler): void
{
$this->sessionHandler = $sessionHandler;
}

public function injectCartUtility(CartUtility $cartUtility): void
{
$this->cartUtility = $cartUtility;
}

public function injectEventDispatcher(EventDispatcherInterface $eventDispatcher): void
{
$this->eventDispatcher = $eventDispatcher;
}

public function __construct(protected ConfigurationManagerInterface $configurationManager)
{
public function __construct(
protected ConfigurationManagerInterface $configurationManager,
protected SessionHandler $sessionHandler,
protected CartUtility $cartUtility,
protected EventDispatcherInterface $eventDispatcher
) {
$this->configurations = $this->configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,
'Cart'
Expand Down
41 changes: 8 additions & 33 deletions Classes/Domain/Model/Cart/BeVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,16 @@ class BeVariant
{
private ?EventDispatcherInterface $eventDispatcher = null;

protected string $id = '';

protected ?Product $product = null;

protected ?BeVariant $parentBeVariant = null;

protected string $title = '';

protected string $titleDelimiter = ' - ';

protected string $sku = '';

protected string $skuDelimiter = '-';

protected int $priceCalcMethod = 0;

protected float $price = 0.0;

protected ?float $specialPrice = null;

protected int $quantity = 0;

protected array $beVariants = [];

protected float $gross = 0.0;
Expand All @@ -60,14 +48,14 @@ class BeVariant
protected int $stock = 0;

public function __construct(
string $id,
protected string $id,
Product $product = null,
self $beVariant = null,
string $title,
string $sku,
int $priceCalcMethod,
float $price,
int $quantity = 0
protected string $title,
protected string $sku,
protected int $priceCalcMethod,
protected float $price,
protected int $quantity = 0
) {
if ($product === null && $beVariant === null) {
throw new \InvalidArgumentException();
Expand All @@ -77,8 +65,6 @@ public function __construct(
throw new \InvalidArgumentException();
}

$this->id = $id;

if ($product !== null) {
$this->product = $product;
}
Expand All @@ -87,12 +73,6 @@ public function __construct(
$this->parentBeVariant = $beVariant;
}

$this->title = $title;
$this->sku = $sku;
$this->priceCalcMethod = $priceCalcMethod;
$this->price = $price;
$this->quantity = $quantity;

$this->reCalc();
}

Expand Down Expand Up @@ -519,11 +499,7 @@ public function getBeVariants(): array

public function getBeVariantById(int $beVariantId): ?self
{
if (isset($this->beVariants[$beVariantId])) {
return $this->beVariants[$beVariantId];
}

return null;
return $this->beVariants[$beVariantId] ?? null;
}

/**
Expand Down Expand Up @@ -647,9 +623,8 @@ public function getAdditional(string $key)

/**
* @param string $key
* @param mixed $value
*/
public function setAdditional($key, $value): void
public function setAdditional($key, mixed $value): void
{
$this->additional[$key] = $value;
}
Expand Down
Loading

0 comments on commit 4a457ba

Please sign in to comment.