From 3e1b20d0600d797cfed7a2bfce010b589073ae71 Mon Sep 17 00:00:00 2001 From: Nikita Date: Tue, 12 Aug 2025 23:56:16 +0200 Subject: [PATCH 1/4] monolog3 --- .github/workflows/grumphp.yml | 2 +- .php-cs-fixer.php | 2 +- Api/Data/EventInterface.php | 2 +- Api/Data/EventSearchResultsInterface.php | 2 +- Api/Data/PaymentInterface.php | 2 +- Api/Data/RecalculateResultInterface.php | 2 +- Api/Data/RecalculateResultItemInterface.php | 2 +- Api/DiscountHelperInterface.php | 4 +-- Api/EventRepositoryInterface.php | 2 +- Api/ItemSkipper.php | 2 +- Api/ProductAttributeHelperInterface.php | 2 +- Api/RecalculationPostHandlerInterface.php | 4 +-- Api/RecalculationPreHandlerInterface.php | 2 +- Api/RecalculatorFacadeInterface.php | 18 +++++----- Block/Adminhtml/Component/Edit/BackButton.php | 2 +- .../Adminhtml/Component/Edit/DeleteButton.php | 4 +-- .../Component/Edit/GenericButton.php | 4 +-- .../Adminhtml/Component/Edit/ResetButton.php | 2 +- .../Component/Edit/SaveAndContinueButton.php | 2 +- Block/Adminhtml/Component/Edit/SaveButton.php | 2 +- Block/Adminhtml/System/Config/AjaxButton.php | 4 +-- Block/Adminhtml/System/Config/CronButton.php | 6 ++-- Block/Extensions.php | 14 ++++---- Controller/Adminhtml/Cron/Schedule.php | 4 +-- Controller/Adminhtml/Event.php | 4 +-- Controller/Adminhtml/Event/Index.php | 4 +-- Helper/Cron.php | 10 +++--- Helper/Currency.php | 4 +-- Helper/Data.php | 12 +++---- Helper/Discount.php | 30 ++++++++-------- Helper/Discount/Math.php | 2 +- Helper/Discount/Tax.php | 4 +-- Helper/Image.php | 8 ++--- Helper/Product/Attribute.php | 8 ++--- Model/Config/Backend/File.php | 18 +++++----- Model/Event.php | 2 +- Model/Event/DataProvider.php | 4 +-- Model/EventRepository.php | 14 ++++---- Model/ImageUploader.php | 16 ++++----- Model/LogManager.php | 8 ++--- Model/Logger/Database.php | 4 +-- Model/Logger/Handler.php | 4 +-- Model/Logger/Logger.php | 6 ++-- Model/Mock/OrderItemMock.php | 12 +++---- Model/Mock/OrderMock.php | 10 +++--- Model/Mock/OrderMockBuilder.php | 8 ++--- Model/Mock/OrderPaymentMock.php | 4 +-- Model/OrderRepository.php | 2 +- Model/Payment/Transaction.php | 4 +-- Model/Recalculator/Result.php | 2 +- Model/Recalculator/Result/Item.php | 2 +- Model/Recalculator/ResultFactory.php | 4 +-- Model/ResourceModel/Event.php | 2 +- Model/ResourceModel/Event/Collection.php | 4 +-- Model/ResourceModel/Event/Grid/Collection.php | 6 ++-- Model/Source/AbstractAttributes.php | 6 ++-- Model/Source/Attributes.php | 2 +- Model/Source/LogTarget.php | 2 +- Model/Source/Loglevel.php | 2 +- Model/Source/OrderItem.php | 4 +-- Model/Source/Payments.php | 4 +-- Model/Source/State.php | 2 +- Model/Source/Status.php | 2 +- Plugin/Transaction.php | 4 +-- Service/PostHandlers/AddChildrenOfBundle.php | 18 +++++----- Service/PostHandlers/AddExtraDiscounts.php | 6 ++-- Service/PostHandlers/RestoreSkippedItems.php | 12 +++---- Service/PreHandlers/SkipItems.php | 2 +- .../SkipItems/SkippedItemFixer.php | 6 ++-- .../SkipItems/SkippedItemsCollector.php | 4 +-- Service/RecalculatorFacade.php | 20 +++++------ Test/Extra/DiscountHelperInterfaceFactory.php | 4 +-- Test/Extra/ExpectedMaker.php | 2 +- Test/Extra/GetRecalculateResultFactory.php | 10 +++--- .../RecalculateResultInterfaceFactory.php | 4 +-- .../RecalculateResultItemInterfaceFactory.php | 4 +-- Test/Extra/TableOutput.php | 2 +- Test/Extra/TestItemSkipper.php | 2 +- .../DiscountHelper/AffectsShippingTest.php | 2 +- Test/Unit/DiscountHelper/GeneralTestCase.php | 18 +++++----- Test/Unit/DiscountHelper/MarkingItemsTest.php | 10 +++--- Test/Unit/DiscountHelper/SplitItemsTest.php | 2 +- .../DiscountHelper/SpreadAndSplitTest.php | 2 +- .../DiscountHelper/SpreadOnAllItemsTest.php | 2 +- Test/Unit/DiscountHelper/WithoutCalcTest.php | 2 +- .../WithoutExtraDiscountsInPrice.php | 2 +- Test/Unit/Facade/AbstractFacadeTest.php | 8 ++--- .../StepByStepBundleDataProvider.php | 2 +- .../AllHandlers/StepByStepBundleTest.php | 34 +++++++++---------- Test/Unit/Facade/AllHandlersDataProvider.php | 2 +- Test/Unit/Facade/AllHandlersTest.php | 18 +++++----- .../AddChildrenOfBundleHandlerTest.php | 6 ++-- .../Handlers/AddExtraDiscountsHandlerTest.php | 6 ++-- .../DataProvider/BundlesDataProvider.php | 2 +- .../ExtraDiscountsDataProvider.php | 2 +- .../DataProvider/SkipItemsDataProvider.php | 2 +- .../SkipItem/SkippedItemFixerDataProvider.php | 2 +- .../SkipItem/SkippedItemFixerTest.php | 10 +++--- .../Facade/Handlers/SkipItemsHandlerTest.php | 16 ++++----- .../TaxHelper/DiscountAmountInclTaxTest.php | 2 +- Test/framework/autoload.php | 6 ++-- Test/framework/bootstrap.php | 6 ++-- Ui/Component/Listing/Actions.php | 8 ++--- Ui/Component/Listing/Thumbnail.php | 8 ++--- composer.json | 2 +- registration.php | 4 +-- 106 files changed, 311 insertions(+), 313 deletions(-) diff --git a/.github/workflows/grumphp.yml b/.github/workflows/grumphp.yml index 305ae6f..12eac2e 100644 --- a/.github/workflows/grumphp.yml +++ b/.github/workflows/grumphp.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3', '8.4'] steps: - uses: actions/checkout@v4 diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 87c4b52..0f44c27 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,7 +1,7 @@ __('Delete'), 'class' => 'delete', 'on_click' => 'deleteConfirm(\'' . __( - 'Are you sure you want to do this?' + 'Are you sure you want to do this?', ) . '\', \'' . $this->getDeleteUrl() . '\')', 'sort_order' => 20, ]; diff --git a/Block/Adminhtml/Component/Edit/GenericButton.php b/Block/Adminhtml/Component/Edit/GenericButton.php index 82c7a8b..b79e734 100644 --- a/Block/Adminhtml/Component/Edit/GenericButton.php +++ b/Block/Adminhtml/Component/Edit/GenericButton.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -24,7 +24,7 @@ class GenericButton * @param \Magento\Backend\Block\Widget\Context $context */ public function __construct( - \Magento\Backend\Block\Widget\Context $context + \Magento\Backend\Block\Widget\Context $context, ) { $this->context = $context; } diff --git a/Block/Adminhtml/Component/Edit/ResetButton.php b/Block/Adminhtml/Component/Edit/ResetButton.php index 2be2e1f..f727d01 100644 --- a/Block/Adminhtml/Component/Edit/ResetButton.php +++ b/Block/Adminhtml/Component/Edit/ResetButton.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Block/Adminhtml/Component/Edit/SaveAndContinueButton.php b/Block/Adminhtml/Component/Edit/SaveAndContinueButton.php index abe5c90..9087954 100644 --- a/Block/Adminhtml/Component/Edit/SaveAndContinueButton.php +++ b/Block/Adminhtml/Component/Edit/SaveAndContinueButton.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Block/Adminhtml/Component/Edit/SaveButton.php b/Block/Adminhtml/Component/Edit/SaveButton.php index 713b9b7..ca36fe3 100644 --- a/Block/Adminhtml/Component/Edit/SaveButton.php +++ b/Block/Adminhtml/Component/Edit/SaveButton.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Block/Adminhtml/System/Config/AjaxButton.php b/Block/Adminhtml/System/Config/AjaxButton.php index 619f5e8..760992a 100644 --- a/Block/Adminhtml/System/Config/AjaxButton.php +++ b/Block/Adminhtml/System/Config/AjaxButton.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -73,7 +73,7 @@ protected function _getElementHtml(\Magento\Framework\Data\Form\Element\Abstract 'html_id' => $element->getHtmlId(), 'ajax_url' => $this->getActionUrl($originalData), 'original_data' => $originalData, - ] + ], ); return $this->_toHtml(); diff --git a/Block/Adminhtml/System/Config/CronButton.php b/Block/Adminhtml/System/Config/CronButton.php index 382a36c..a6047a2 100644 --- a/Block/Adminhtml/System/Config/CronButton.php +++ b/Block/Adminhtml/System/Config/CronButton.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -28,7 +28,7 @@ class CronButton extends AjaxButton public function __construct( \Mygento\Base\Helper\Cron $cronHelper, \Magento\Backend\Block\Template\Context $context, - array $data = [] + array $data = [], ) { parent::__construct($context, $data); $this->cronHelper = $cronHelper; @@ -67,7 +67,7 @@ protected function getActionUrl($fieldConfig) [ 'form_key' => $this->getFormKey(), 'job' => $fieldConfig['job_code'], - ] + ], ); } } diff --git a/Block/Extensions.php b/Block/Extensions.php index 313cc89..2414ddd 100644 --- a/Block/Extensions.php +++ b/Block/Extensions.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -79,7 +79,7 @@ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Framework\View\Helper\Js $jsHelper, - array $data = [] + array $data = [], ) { parent::__construct($context, $authSession, $jsHelper, $data); @@ -114,18 +114,18 @@ public function render(AbstractElement $element) $url = __( 'Purchased extensions support is available through ' . 'ticket tracking system', - $ticketUrl + $ticketUrl, ); $bugs = __('Please report all bugs and feature requests.'); $emailtext = __( 'If for some reasons you can not submit ticket ' . 'to our system, you can write us an email %1.', - $email + $email, ); $hiretext = __( 'You can hire us for any Magento extension customization and development.' . '
Write us to %1', - $email + $email, ); $tender = __('Tender offer can be checked ' . 'here'); @@ -141,7 +141,7 @@ public function render(AbstractElement $element) . '' . $hiretext . '

' . __( 'You can check all providable services on ' . 'our website.', - $site . '/services' + $site . '/services', ) . ''; $html .= ''; @@ -176,7 +176,7 @@ private function getFieldRenderer() $layout = $this->layoutFactory->create(); $this->fieldRenderer = $layout->createBlock( - \Magento\Config\Block\System\Config\Form\Field::class + \Magento\Config\Block\System\Config\Form\Field::class, ); } diff --git a/Controller/Adminhtml/Cron/Schedule.php b/Controller/Adminhtml/Cron/Schedule.php index fc459ae..3d27e5d 100644 --- a/Controller/Adminhtml/Cron/Schedule.php +++ b/Controller/Adminhtml/Cron/Schedule.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -28,7 +28,7 @@ class Schedule extends \Magento\Backend\App\Action public function __construct( \Mygento\Base\Helper\Cron $cronHelper, \Magento\Framework\Controller\Result\JsonFactory $jsonResult, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($context); $this->jsonResult = $jsonResult; diff --git a/Controller/Adminhtml/Event.php b/Controller/Adminhtml/Event.php index b76e404..7e9f0e9 100644 --- a/Controller/Adminhtml/Event.php +++ b/Controller/Adminhtml/Event.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -39,7 +39,7 @@ abstract class Event extends \Magento\Backend\App\Action public function __construct( \Mygento\Base\Api\EventRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { parent::__construct($context); $this->repository = $repository; diff --git a/Controller/Adminhtml/Event/Index.php b/Controller/Adminhtml/Event/Index.php index d7dd124..360a5af 100644 --- a/Controller/Adminhtml/Event/Index.php +++ b/Controller/Adminhtml/Event/Index.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -23,7 +23,7 @@ public function __construct( \Magento\Framework\View\Result\PageFactory $resultPageFactory, \Mygento\Base\Api\EventRepositoryInterface $repository, \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context + \Magento\Backend\App\Action\Context $context, ) { $this->resultPageFactory = $resultPageFactory; parent::__construct($repository, $coreRegistry, $context); diff --git a/Helper/Cron.php b/Helper/Cron.php index a73f82d..5000abf 100644 --- a/Helper/Cron.php +++ b/Helper/Cron.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -42,7 +42,7 @@ public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone, \Magento\Cron\Model\ScheduleFactory $entity, \Magento\Cron\Model\ResourceModel\Schedule\CollectionFactory $collection, - \Magento\Framework\App\Helper\Context $context + \Magento\Framework\App\Helper\Context $context, ) { parent::__construct($context); $this->collection = $collection; @@ -97,7 +97,7 @@ public function getLastUpdate(string $jobCode) $collection->addFieldToFilter('job_code', $jobCode); $collection->addFieldToFilter( 'status', - ['eq' => \Magento\Cron\Model\Schedule::STATUS_SUCCESS] + ['eq' => \Magento\Cron\Model\Schedule::STATUS_SUCCESS], ); $collection->setPageSize(1); $collection->addOrder('finished_at', $collection::SORT_ORDER_DESC); @@ -107,7 +107,7 @@ public function getLastUpdate(string $jobCode) } $date = $this->timezone->date( - new \DateTime($collection->getFirstItem()->getFinishedAt()) + new \DateTime($collection->getFirstItem()->getFinishedAt()), ); return $date->format('d.m.Y H:i:s'); @@ -122,7 +122,7 @@ private function clearOldSchedules(string $jobCode) $schedules->addFieldToFilter('job_code', $jobCode); $schedules->addFieldToFilter( 'status', - ['in' => [\Magento\Cron\Model\Schedule::STATUS_PENDING]] + ['in' => [\Magento\Cron\Model\Schedule::STATUS_PENDING]], ); $schedules->walk('delete'); } diff --git a/Helper/Currency.php b/Helper/Currency.php index 5a1ea2e..bddec37 100644 --- a/Helper/Currency.php +++ b/Helper/Currency.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -28,7 +28,7 @@ class Currency extends \Magento\Framework\App\Helper\AbstractHelper public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Framework\App\Helper\Context $context + \Magento\Framework\App\Helper\Context $context, ) { parent::__construct($context); diff --git a/Helper/Data.php b/Helper/Data.php index a70599a..0413c4e 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -31,7 +31,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper implements Logge public function __construct( \Mygento\Base\Model\LogManager $logManager, \Magento\Framework\Encryption\Encryptor $encryptor, - \Magento\Framework\App\Helper\Context $context + \Magento\Framework\App\Helper\Context $context, ) { parent::__construct($context); @@ -70,7 +70,7 @@ public function batchInsertData( array $insertData, array $updateFields = [], bool $clean = false, - $cleanWhere = '' + $cleanWhere = '', ) { try { $conn->beginTransaction(); @@ -81,7 +81,7 @@ public function batchInsertData( $conn->insertOnDuplicate( $table, $row, - $updateFields + $updateFields, ); } $conn->commit(); @@ -123,7 +123,7 @@ public function getConfig($configPath, $scopeCode = null) return $this->scopeConfig->getValue( $configPath, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $scopeCode + $scopeCode, ); } @@ -137,7 +137,7 @@ public function getGlobalConfig($configPath, $scopeCode = null) return $this->scopeConfig->getValue( $configPath, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $scopeCode + $scopeCode, ); } diff --git a/Helper/Discount.php b/Helper/Discount.php index 0fecae1..aadc06e 100644 --- a/Helper/Discount.php +++ b/Helper/Discount.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -103,7 +103,7 @@ class Discount implements DiscountHelperInterface */ public function __construct( \Mygento\Base\Helper\Data $baseHelper, - \Mygento\Base\Helper\Product\Attribute $attributeHelper + \Mygento\Base\Helper\Product\Attribute $attributeHelper, ) { $this->generalHelper = $baseHelper; $this->attributeHelper = $attributeHelper; @@ -119,7 +119,7 @@ public function getRecalculated( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { if (!$entity) { return null; @@ -143,11 +143,11 @@ public function getRecalculated( $this->generalHelper->debug( '== START == Recalculation of entity prices. Helper Version: ' . self::VERSION . '. Entity class: ' . get_class($entity) - . ". Entity id: {$entity->getEntityId()}" + . ". Entity id: {$entity->getEntityId()}", ); $this->generalHelper->debug('Do calculation: ' . ($this->doCalculation ? 'Yes' : 'No')); $this->generalHelper->debug( - 'Spread discount: ' . ($this->spreadDiscOnAllUnits ? 'Yes' : 'No') + 'Spread discount: ' . ($this->spreadDiscOnAllUnits ? 'Yes' : 'No'), ); $this->generalHelper->debug('Split items: ' . ($this->isSplitItemsAllowed ? 'Yes' : 'No')); //Если есть RewardPoints - то калькуляцию применять необходимо принудительно @@ -155,7 +155,7 @@ public function getRecalculated( $this->doCalculation = true; $this->generalHelper->debug( 'SplitItems and DoCalculation set to true' - . ' because of global Discount (e.g. reward points)' + . ' because of global Discount (e.g. reward points)', ); } switch (true) { @@ -175,8 +175,8 @@ public function getRecalculated( } $this->generalHelper->debug( '== STOP == Recalculation. Entity class: ' . get_class( - $entity - ) . ". Entity id: {$entity->getEntityId()}" + $entity, + ) . ". Entity id: {$entity->getEntityId()}", ); return $this->buildFinalArray(); @@ -552,7 +552,7 @@ private function buildFinalArray() if (!$this->checkReceipt($receipt)) { $this->generalHelper->debug( - 'WARNING: Calculation error! Sum of items is not equal to grandTotal!' + 'WARNING: Calculation error! Sum of items is not equal to grandTotal!', ); } @@ -575,7 +575,7 @@ private function buildItem($item, $price, $taxValue = '') $qty = $item->getQty() ?: $item->getQtyOrdered(); if (!$qty) { throw new \Exception( - 'Divide by zero. Qty of the item is equal to zero! Item: ' . $item->getId() + 'Divide by zero. Qty of the item is equal to zero! Item: ' . $item->getId(), ); } @@ -592,7 +592,7 @@ private function buildItem($item, $price, $taxValue = '') $entityItem[self::SUM] = round( $item->getData('row_total_incl_tax') - $discountAmountInclTax, - 2 + 2, ); $entityItem[self::PRICE] = 1; } @@ -694,9 +694,9 @@ private function splitMarkFinalItems($item, array $items1, array $items2 = []) 'base64_decode', array_map( 'trim', - explode(',', $this->getItemMark($item)) - ) - ) + explode(',', $this->getItemMark($item)), + ), + ), ); } @@ -791,7 +791,7 @@ function ($carry, $item) { $carry += $item[self::SUM]; return $carry; - } + }, ); return bcsub((string) $sum, (string) $receipt[self::ORIG_GRAND_TOTAL], 2) === '0.00'; diff --git a/Helper/Discount/Math.php b/Helper/Discount/Math.php index e417c15..bc31f73 100644 --- a/Helper/Discount/Math.php +++ b/Helper/Discount/Math.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Helper/Discount/Tax.php b/Helper/Discount/Tax.php index 08bf878..15caf5f 100644 --- a/Helper/Discount/Tax.php +++ b/Helper/Discount/Tax.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -68,7 +68,7 @@ public static function getShippingDiscountAmountInclTax($entity) $hasTaxInShippingDiscount = bccomp( (string) $entity->getShippingTaxAmount(), (string) ($entity->getShippingAmount() * ($ratio - 1)), - 2 + 2, ) === 0; return $hasTaxInShippingDiscount diff --git a/Helper/Image.php b/Helper/Image.php index e6d09f2..b7d8e76 100644 --- a/Helper/Image.php +++ b/Helper/Image.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -45,7 +45,7 @@ public function __construct( \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Image\AdapterFactory $imageFactory, \Magento\Framework\View\ConfigInterface $configInterface, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, ) { $this->storeManager = $storeManager; $this->filesystem = $filesystem; @@ -120,7 +120,7 @@ public function getImageConfig($viewId, $moduleName) if (!$this->imageConfig) { $this->imageConfig = $this->viewConfig->getViewConfig()->getMediaEntities( $moduleName, - 'images' + 'images', ); } @@ -134,7 +134,7 @@ public function getImageConfig($viewId, $moduleName) public function getMediaUrl(): string { return $this->storeManager->getStore()->getBaseUrl( - \Magento\Framework\UrlInterface::URL_TYPE_MEDIA + \Magento\Framework\UrlInterface::URL_TYPE_MEDIA, ); } } diff --git a/Helper/Product/Attribute.php b/Helper/Product/Attribute.php index 69e31f1..c4aca5d 100644 --- a/Helper/Product/Attribute.php +++ b/Helper/Product/Attribute.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -35,7 +35,7 @@ class Attribute implements ProductAttributeHelperInterface public function __construct( \Mygento\Base\Helper\Data $generalHelper, \Magento\Catalog\Model\ResourceModel\Product $productResource, - \Magento\Store\Model\StoreManagerInterface $storeManager + \Magento\Store\Model\StoreManagerInterface $storeManager, ) { $this->generalHelper = $generalHelper; $this->productResource = $productResource; @@ -50,7 +50,7 @@ public function getValueByConfigPathOrDefault(string $pathToParam, $productId) $attributeCode = $this->generalHelper->getGlobalConfig($pathToParam); if (!$attributeCode || '0' === $attributeCode || 0 === $attributeCode) { return $this->generalHelper->getGlobalConfig( - $pathToParam . self::CONFIG_PATH_DEFAULT_SUFFIX + $pathToParam . self::CONFIG_PATH_DEFAULT_SUFFIX, ); } @@ -60,7 +60,7 @@ public function getValueByConfigPathOrDefault(string $pathToParam, $productId) } return $this->generalHelper->getGlobalConfig( - $pathToParam . self::CONFIG_PATH_DEFAULT_SUFFIX + $pathToParam . self::CONFIG_PATH_DEFAULT_SUFFIX, ); } diff --git a/Model/Config/Backend/File.php b/Model/Config/Backend/File.php index faf11a3..be359a7 100644 --- a/Model/Config/Backend/File.php +++ b/Model/Config/Backend/File.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -72,7 +72,7 @@ public function __construct( \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, - array $data = [] + array $data = [], ) { parent::__construct( $context, @@ -81,7 +81,7 @@ public function __construct( $cacheTypeList, $resource, $resourceCollection, - $data + $data, ); $this->requestData = $requestData; $this->filesystem = $filesystem; @@ -146,14 +146,14 @@ public function validateMaxSize($filePath) if ( $this->maxFileSize > 0 && $directory->stat( - $directory->getRelativePath($filePath) + $directory->getRelativePath($filePath), )['size'] > $this->maxFileSize * 1024 ) { throw new LocalizedException( __( 'The file you\'re uploading exceeds the server size limit of %1 kilobytes.', - $this->maxFileSize - ) + $this->maxFileSize, + ), ); } } @@ -204,7 +204,7 @@ private function addWhetherScopeInfo() return is_array($dirParams) && array_key_exists( 'scope_info', - $dirParams + $dirParams, ) && $dirParams['scope_info']; } @@ -221,7 +221,7 @@ private function getUploadDir() if (!array_key_exists('upload_dir', $fieldConfig)) { throw new LocalizedException( - __('The base directory to upload file is not specified.') + __('The base directory to upload file is not specified.'), ); } @@ -230,7 +230,7 @@ private function getUploadDir() if ( array_key_exists( 'scope_info', - $fieldConfig['upload_dir'] + $fieldConfig['upload_dir'], ) && $fieldConfig['upload_dir']['scope_info'] ) { $uploadDir = $this->appendScopeInfo($uploadDir); diff --git a/Model/Event.php b/Model/Event.php index c04dc6b..80171c5 100644 --- a/Model/Event.php +++ b/Model/Event.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/Event/DataProvider.php b/Model/Event/DataProvider.php index 2e841f7..5e510b5 100644 --- a/Model/Event/DataProvider.php +++ b/Model/Event/DataProvider.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -38,7 +38,7 @@ public function __construct( $primaryFieldName, $requestFieldName, array $meta = [], - array $data = [] + array $data = [], ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); $this->collection = $collectionFactory->create(); diff --git a/Model/EventRepository.php b/Model/EventRepository.php index 8d4c6eb..c00618d 100644 --- a/Model/EventRepository.php +++ b/Model/EventRepository.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -38,7 +38,7 @@ public function __construct( ResourceModel\Event $resource, ResourceModel\Event\CollectionFactory $collectionFactory, \Mygento\Base\Api\Data\EventInterfaceFactory $entityFactory, - \Mygento\Base\Api\Data\EventSearchResultsInterfaceFactory $searchResultsFactory + \Mygento\Base\Api\Data\EventSearchResultsInterfaceFactory $searchResultsFactory, ) { $this->resource = $resource; $this->collectionFactory = $collectionFactory; @@ -57,7 +57,7 @@ public function getById($entityId) $this->resource->load($entity, $entityId); if (!$entity->getId()) { throw new \Magento\Framework\Exception\NoSuchEntityException( - __('Base Event with id "%1" does not exist.', $entityId) + __('Base Event with id "%1" does not exist.', $entityId), ); } @@ -66,9 +66,9 @@ public function getById($entityId) /** * @param \Mygento\Base\Api\Data\EventInterface $entity + * @psalm-param \Mygento\Base\Api\Data\EventInterface&\Magento\Framework\Model\AbstractModel $event * @throws \Magento\Framework\Exception\CouldNotSaveException * @return \Mygento\Base\Api\Data\EventInterface - * @psalm-param \Mygento\Base\Api\Data\EventInterface&\Magento\Framework\Model\AbstractModel $event */ public function save(\Mygento\Base\Api\Data\EventInterface $entity) { @@ -77,7 +77,7 @@ public function save(\Mygento\Base\Api\Data\EventInterface $entity) $this->resource->save($entity); } catch (\Exception $exception) { throw new \Magento\Framework\Exception\CouldNotSaveException( - __($exception->getMessage()) + __($exception->getMessage()), ); } @@ -95,7 +95,7 @@ public function delete(\Mygento\Base\Api\Data\EventInterface $entity) $this->resource->delete($entity); } catch (\Exception $exception) { throw new \Magento\Framework\Exception\CouldNotDeleteException( - __($exception->getMessage()) + __($exception->getMessage()), ); } @@ -142,7 +142,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria foreach ($sortOrders as $sortOrder) { $collection->addOrder( $sortOrder->getField(), - ($sortOrder->getDirection() == $sortAsc) ? $orderAsc : $orderDesc + ($sortOrder->getDirection() == $sortAsc) ? $orderAsc : $orderDesc, ); } } diff --git a/Model/ImageUploader.php b/Model/ImageUploader.php index f832bc0..16939ec 100644 --- a/Model/ImageUploader.php +++ b/Model/ImageUploader.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -57,7 +57,7 @@ public function __construct( \Psr\Log\LoggerInterface $logger, string $baseTmpPath, string $basePath, - array $allowedExtensions + array $allowedExtensions, ) { $this->coreFileStorageDatabase = $coreFileStorageDatabase; $this->filesystem = $filesystem; @@ -122,7 +122,7 @@ public function getBaseUrl(): string { return $this->storeManager->getStore() ->getBaseUrl( - \Magento\Framework\UrlInterface::URL_TYPE_MEDIA + \Magento\Framework\UrlInterface::URL_TYPE_MEDIA, ); } @@ -172,15 +172,15 @@ public function moveFileFromTmp(string $imageName): string try { $this->coreFileStorageDatabase->copyFile( $baseTmpImagePath, - $baseImagePath + $baseImagePath, ); $this->mediaDirectory->renameFile( $baseTmpImagePath, - $baseImagePath + $baseImagePath, ); } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException( - __('Something went wrong while saving the file(s).') + __('Something went wrong while saving the file(s).'), ); } @@ -201,7 +201,7 @@ public function saveFileToTmpDir($fileId): array $result = $uploader->save($this->mediaDirectory->getAbsolutePath($baseTmpPath)); if (!$result) { throw new \Magento\Framework\Exception\LocalizedException( - __('File can not be saved to the destination folder.') + __('File can not be saved to the destination folder.'), ); } @@ -219,7 +219,7 @@ public function saveFileToTmpDir($fileId): array $this->logger->critical((string) $e); throw new \Magento\Framework\Exception\LocalizedException( - __('Something went wrong while saving the file(s).') + __('Something went wrong while saving the file(s).'), ); } } diff --git a/Model/LogManager.php b/Model/LogManager.php index 5ad2d9d..7c8c556 100644 --- a/Model/LogManager.php +++ b/Model/LogManager.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -25,7 +25,7 @@ class LogManager */ public function __construct( \Mygento\Base\Model\Logger\LoggerFactory $loggerFactory, - $handlers = [] + $handlers = [], ) { $this->handlers = $handlers; $this->loggerFactory = $loggerFactory; @@ -41,14 +41,14 @@ public function __construct( public function getLogger( $name, $type = 'file', - $level = \Monolog\Logger::DEBUG + $level = \Monolog\Logger::DEBUG, ) { if (isset($this->loggers[$name])) { return $this->loggers[$name]; } if (!isset($this->handlers[$type])) { throw new \Magento\Framework\Exception\LocalizedException( - __('No Logger Handlers') + __('No Logger Handlers'), ); } $logger = $this->loggerFactory->create(['name' => $name]); diff --git a/Model/Logger/Database.php b/Model/Logger/Database.php index db31c2d..377ccef 100644 --- a/Model/Logger/Database.php +++ b/Model/Logger/Database.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -37,7 +37,7 @@ public function __construct( \Magento\Framework\Serialize\SerializerInterface $serializer, \Mygento\Base\Api\Data\EventInterfaceFactory $eventFactory, $level = \Monolog\Logger::DEBUG, - $bubble = true + $bubble = true, ) { parent::__construct($level, $bubble); $this->eventRepository = $eventRepository; diff --git a/Model/Logger/Handler.php b/Model/Logger/Handler.php index f7e7f2c..2ca65ed 100644 --- a/Model/Logger/Handler.php +++ b/Model/Logger/Handler.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -18,7 +18,7 @@ class Handler extends \Magento\Framework\Logger\Handler\Base public function __construct( $name, \Magento\Framework\Filesystem\DriverInterface $filesystem, - $filePath = null + $filePath = null, ) { $this->fileName = DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR . $name . '.log'; diff --git a/Model/Logger/Logger.php b/Model/Logger/Logger.php index c845cf3..3d148d7 100644 --- a/Model/Logger/Logger.php +++ b/Model/Logger/Logger.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -14,11 +14,11 @@ class Logger extends \Magento\Framework\Logger\Monolog * @param string $name */ public function __construct( - $name + $name, ) { parent::__construct( $name, - [] + [], ); } } diff --git a/Model/Mock/OrderItemMock.php b/Model/Mock/OrderItemMock.php index e1e7858..ecb58c1 100644 --- a/Model/Mock/OrderItemMock.php +++ b/Model/Mock/OrderItemMock.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -780,28 +780,28 @@ public function setBaseDiscountTaxCompensationAmount($amount) public function setDiscountTaxCompensationInvoiced($discountTaxCompensationInvoiced) { return parent::setDiscountTaxCompensationInvoiced( - $discountTaxCompensationInvoiced + $discountTaxCompensationInvoiced, ); } public function setBaseDiscountTaxCompensationInvoiced($baseDiscountTaxCompensationInvoiced) { return parent::setBaseDiscountTaxCompensationInvoiced( - $baseDiscountTaxCompensationInvoiced + $baseDiscountTaxCompensationInvoiced, ); } public function setDiscountTaxCompensationRefunded($discountTaxCompensationRefunded) { return parent::setDiscountTaxCompensationRefunded( - $discountTaxCompensationRefunded + $discountTaxCompensationRefunded, ); } public function setBaseDiscountTaxCompensationRefunded($baseDiscountTaxCompensationRefunded) { return parent::setBaseDiscountTaxCompensationRefunded( - $baseDiscountTaxCompensationRefunded + $baseDiscountTaxCompensationRefunded, ); } @@ -813,7 +813,7 @@ public function setTaxCanceled($taxCanceled) public function setDiscountTaxCompensationCanceled($discountTaxCompensationCanceled) { return parent::setDiscountTaxCompensationCanceled( - $discountTaxCompensationCanceled + $discountTaxCompensationCanceled, ); } diff --git a/Model/Mock/OrderMock.php b/Model/Mock/OrderMock.php index a1e0357..063f1a9 100644 --- a/Model/Mock/OrderMock.php +++ b/Model/Mock/OrderMock.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -1372,28 +1372,28 @@ public function setBaseShippingDiscountTaxCompensationAmnt($amnt) public function setDiscountTaxCompensationInvoiced($discountTaxCompensationInvoiced) { return parent::setDiscountTaxCompensationInvoiced( - $discountTaxCompensationInvoiced + $discountTaxCompensationInvoiced, ); } public function setBaseDiscountTaxCompensationInvoiced($baseDiscountTaxCompensationInvoiced) { return parent::setBaseDiscountTaxCompensationInvoiced( - $baseDiscountTaxCompensationInvoiced + $baseDiscountTaxCompensationInvoiced, ); } public function setDiscountTaxCompensationRefunded($discountTaxCompensationRefunded) { return parent::setDiscountTaxCompensationRefunded( - $discountTaxCompensationRefunded + $discountTaxCompensationRefunded, ); } public function setBaseDiscountTaxCompensationRefunded($baseDiscountTaxCompensationRefunded) { return parent::setBaseDiscountTaxCompensationRefunded( - $baseDiscountTaxCompensationRefunded + $baseDiscountTaxCompensationRefunded, ); } diff --git a/Model/Mock/OrderMockBuilder.php b/Model/Mock/OrderMockBuilder.php index a24157b..9e63844 100644 --- a/Model/Mock/OrderMockBuilder.php +++ b/Model/Mock/OrderMockBuilder.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -29,7 +29,7 @@ public static function getNewOrderInstance( $grandTotal, $shippingInclTax, $rewardPoints = 0.00, - $discountAmount = null + $discountAmount = null, ): OrderInterface { $order = new OrderMock(); $payment = new OrderPaymentMock(); @@ -41,7 +41,7 @@ public static function getNewOrderInstance( $order->setData( 'discount_amount', $discountAmount ?? - $grandTotal + $rewardPoints - $subTotalInclTax - $shippingInclTax + $grandTotal + $rewardPoints - $subTotalInclTax - $shippingInclTax, ); $order->setPayment($payment); @@ -65,7 +65,7 @@ public static function getItem( $qty = 1, $taxPercent = 0, $taxAmount = 0, - $rowTotal = null + $rowTotal = null, ): OrderItemMock { static $id = 100500; $id++; diff --git a/Model/Mock/OrderPaymentMock.php b/Model/Mock/OrderPaymentMock.php index 9f38d5f..07d9bac 100644 --- a/Model/Mock/OrderPaymentMock.php +++ b/Model/Mock/OrderPaymentMock.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -1067,7 +1067,7 @@ public function hasAdditionalInformation($key = null) return null === $key ? !empty($this->additionalInformation) : array_key_exists( $key, - $this->additionalInformation + $this->additionalInformation, ); } diff --git a/Model/OrderRepository.php b/Model/OrderRepository.php index 23f5409..e16c3dd 100644 --- a/Model/OrderRepository.php +++ b/Model/OrderRepository.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/Payment/Transaction.php b/Model/Payment/Transaction.php index dec2d38..16fa8eb 100644 --- a/Model/Payment/Transaction.php +++ b/Model/Payment/Transaction.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -44,7 +44,7 @@ protected function _verifyTxnType($txnType = null) break; default: throw new LocalizedException( - __('We found an unsupported transaction type "%1".', $txnType) + __('We found an unsupported transaction type "%1".', $txnType), ); } } diff --git a/Model/Recalculator/Result.php b/Model/Recalculator/Result.php index 3a25165..49b3ffc 100644 --- a/Model/Recalculator/Result.php +++ b/Model/Recalculator/Result.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/Recalculator/Result/Item.php b/Model/Recalculator/Result/Item.php index ac23455..2f3f91b 100644 --- a/Model/Recalculator/Result/Item.php +++ b/Model/Recalculator/Result/Item.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/Recalculator/ResultFactory.php b/Model/Recalculator/ResultFactory.php index a0a3085..3890f41 100644 --- a/Model/Recalculator/ResultFactory.php +++ b/Model/Recalculator/ResultFactory.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -33,7 +33,7 @@ class ResultFactory */ public function __construct( RecalculateResultInterfaceFactory $resultInterfaceFactory, - RecalculateResultItemInterfaceFactory $itemInterfaceFactory + RecalculateResultItemInterfaceFactory $itemInterfaceFactory, ) { $this->itemInterfaceFactory = $itemInterfaceFactory; $this->resultInterfaceFactory = $resultInterfaceFactory; diff --git a/Model/ResourceModel/Event.php b/Model/ResourceModel/Event.php index d8c5e9d..92a20b0 100644 --- a/Model/ResourceModel/Event.php +++ b/Model/ResourceModel/Event.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/ResourceModel/Event/Collection.php b/Model/ResourceModel/Event/Collection.php index 0f49200..3b295e9 100644 --- a/Model/ResourceModel/Event/Collection.php +++ b/Model/ResourceModel/Event/Collection.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -20,7 +20,7 @@ protected function _construct() { $this->_init( \Mygento\Base\Model\Event::class, - \Mygento\Base\Model\ResourceModel\Event::class + \Mygento\Base\Model\ResourceModel\Event::class, ); } } diff --git a/Model/ResourceModel/Event/Grid/Collection.php b/Model/ResourceModel/Event/Grid/Collection.php index d34ae68..079161c 100644 --- a/Model/ResourceModel/Event/Grid/Collection.php +++ b/Model/ResourceModel/Event/Grid/Collection.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -42,7 +42,7 @@ public function __construct( string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, - \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null + \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null, ) { parent::__construct( $entityFactory, @@ -50,7 +50,7 @@ public function __construct( $fetchStrategy, $eventManager, $connection, - $resource + $resource, ); $this->_eventPrefix = $eventPrefix; $this->_eventObject = $eventObject; diff --git a/Model/Source/AbstractAttributes.php b/Model/Source/AbstractAttributes.php index a69b707..44536ea 100644 --- a/Model/Source/AbstractAttributes.php +++ b/Model/Source/AbstractAttributes.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -51,13 +51,13 @@ abstract class AbstractAttributes implements \Magento\Framework\Data\OptionSourc */ public function __construct( \Magento\Eav\Model\Entity\Type $entityType, - \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attrColFactory + \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attrColFactory, ) { $this->entityType = $entityType; $this->attrColFactory = $attrColFactory; $this->entityType->loadByCode( - \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, ); } diff --git a/Model/Source/Attributes.php b/Model/Source/Attributes.php index 7bb9b29..83ebbd4 100644 --- a/Model/Source/Attributes.php +++ b/Model/Source/Attributes.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/Source/LogTarget.php b/Model/Source/LogTarget.php index 55ad01d..f301f3d 100644 --- a/Model/Source/LogTarget.php +++ b/Model/Source/LogTarget.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/Source/Loglevel.php b/Model/Source/Loglevel.php index db996d2..a8079f6 100644 --- a/Model/Source/Loglevel.php +++ b/Model/Source/Loglevel.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/Source/OrderItem.php b/Model/Source/OrderItem.php index a8be5ea..5a7e4e6 100644 --- a/Model/Source/OrderItem.php +++ b/Model/Source/OrderItem.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -42,7 +42,7 @@ public function toOptionArray() if ($this->options === null) { $this->options = []; $table = $this->connection->describeTable( - $this->resource->getTableName('sales_order_item') + $this->resource->getTableName('sales_order_item'), ); foreach ($table as $fieldName => $fieldData) { diff --git a/Model/Source/Payments.php b/Model/Source/Payments.php index 8fe5bbe..c640baa 100644 --- a/Model/Source/Payments.php +++ b/Model/Source/Payments.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -20,7 +20,7 @@ class Payments implements \Magento\Framework\Data\OptionSourceInterface * @param \Magento\Payment\Helper\Data $paymentHelper */ public function __construct( - \Magento\Payment\Helper\Data $paymentHelper + \Magento\Payment\Helper\Data $paymentHelper, ) { $this->paymentHelper = $paymentHelper; } diff --git a/Model/Source/State.php b/Model/Source/State.php index 7eb1788..c4447f8 100644 --- a/Model/Source/State.php +++ b/Model/Source/State.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Model/Source/Status.php b/Model/Source/Status.php index fea7a97..883abd9 100644 --- a/Model/Source/Status.php +++ b/Model/Source/Status.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Plugin/Transaction.php b/Plugin/Transaction.php index d5deace..22f667d 100644 --- a/Plugin/Transaction.php +++ b/Plugin/Transaction.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -18,7 +18,7 @@ class Transaction */ public function afterGetTransactionTypes( \Magento\Sales\Model\Order\Payment\Transaction $subject, - $result + $result, ) { return array_merge($result, [ \Mygento\Base\Model\Payment\Transaction::TYPE_CAPTURE_CONFIRM => __('Capture confirm'), diff --git a/Service/PostHandlers/AddChildrenOfBundle.php b/Service/PostHandlers/AddChildrenOfBundle.php index 8f78298..0374172 100644 --- a/Service/PostHandlers/AddChildrenOfBundle.php +++ b/Service/PostHandlers/AddChildrenOfBundle.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -51,7 +51,7 @@ class AddChildrenOfBundle implements RecalculationPostHandlerInterface public function __construct( DiscountHelperInterfaceFactory $discountHelperFactory, ResultFactory $recalculateResultFactory, - RecalculateResultItemInterfaceFactory $recalculateResultItemFactory + RecalculateResultItemInterfaceFactory $recalculateResultItemFactory, ) { $this->discountHelperFactory = $discountHelperFactory; $this->recalculateResultFactory = $recalculateResultFactory; @@ -78,7 +78,7 @@ public function handle( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ): RecalculateResultInterface { $isRecalculated = $order->getPayment()->getAdditionalInformation(PaymentInterface::RECALCULATED_FLAG); @@ -111,7 +111,7 @@ public function handle( $shippingTaxValue, $markingAttributeCode, $markingListAttributeCode, - $markingRefundAttributeCode + $markingRefundAttributeCode, ); $childrenResult = $this->recalculateResultFactory->create($discountData); @@ -270,7 +270,7 @@ private function addItem($order, $item): void private function updateParentItem( OrderItemInterface $parentItem, RecalculateResultInterface $recalcOriginalObject, - RecalculateResultInterface $childrenResultObject + RecalculateResultInterface $childrenResultObject, ): RecalculateResultInterface { $parentRecalculateItem = $recalcOriginalObject->getItemById($parentItem->getItemId()); $children = $childrenResultObject->getItems(); @@ -297,8 +297,8 @@ static function ($item, $key) { return $key !== 'shipping' ? $item->getSum() : 0; }, $recalcOriginal->getItems(), - array_keys($recalcOriginal->getItems()) - ) + array_keys($recalcOriginal->getItems()), + ), ); $recalcOriginal->setSum($newSum); @@ -310,7 +310,7 @@ static function ($item, $key) { */ private function updateShippingAmount( RecalculateResultInterface $recalcOriginal, - RecalculateResultInterface $childrenResult + RecalculateResultInterface $childrenResult, ): void { $childShipping = $childrenResult->getItemById('shipping'); $masterShipping = $recalcOriginal->getItemById('shipping'); @@ -328,7 +328,7 @@ private function updateShippingAmount( private function updateExtraDiscountsOfChildren( OrderItemInterface $parentItem, RecalculateResultInterface $recalcOriginalObject, - Order $dummyOrder + Order $dummyOrder, ) { $recalculatedItem = $recalcOriginalObject->getItemById($parentItem->getItemId()); /** @var \Mygento\Base\Api\DiscountHelperInterface $freshDiscountHelper */ diff --git a/Service/PostHandlers/AddExtraDiscounts.php b/Service/PostHandlers/AddExtraDiscounts.php index 5f9d1cd..cb54bd5 100644 --- a/Service/PostHandlers/AddExtraDiscounts.php +++ b/Service/PostHandlers/AddExtraDiscounts.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -34,7 +34,7 @@ class AddExtraDiscounts implements RecalculationPostHandlerInterface */ public function __construct( DiscountHelperInterfaceFactory $discountHelperFactory, - OrderRepository $orderRepository + OrderRepository $orderRepository, ) { $this->discountHelperFactory = $discountHelperFactory; $this->orderRepository = $orderRepository; @@ -61,7 +61,7 @@ public function handle( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ): RecalculateResultInterface { /** @var \Mygento\Base\Api\DiscountHelperInterface $discountHelper */ $discountHelper = $this->discountHelperFactory->create(); diff --git a/Service/PostHandlers/RestoreSkippedItems.php b/Service/PostHandlers/RestoreSkippedItems.php index e912505..888eaf3 100644 --- a/Service/PostHandlers/RestoreSkippedItems.php +++ b/Service/PostHandlers/RestoreSkippedItems.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -28,7 +28,7 @@ class RestoreSkippedItems implements RecalculationPostHandlerInterface public function __construct( SkippedItemsCollector $skippedItemsCollector, - SkippedItemFixer $skippedItemFixer + SkippedItemFixer $skippedItemFixer, ) { $this->skippedItemFixer = $skippedItemFixer; $this->skippedItemsCollector = $skippedItemsCollector; @@ -54,7 +54,7 @@ public function handle( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ): RecalculateResultInterface { $itemsToSkip = $this->skippedItemsCollector->getItemsToSkip($order); @@ -71,7 +71,7 @@ public function handle( $shippingTaxValue, $markingAttributeCode, $markingListAttributeCode, - $markingRefundAttributeCode + $markingRefundAttributeCode, ); $recalculatedItems[$item->getItemId()] = $skippedRecalculatedItem; } @@ -99,8 +99,8 @@ static function ($item, $key) { return $key !== 'shipping' ? $item->getSum() : 0; }, $recalcOriginal->getItems(), - array_keys($recalcOriginal->getItems()) - ) + array_keys($recalcOriginal->getItems()), + ), ); $recalcOriginal->setSum($newSum); diff --git a/Service/PreHandlers/SkipItems.php b/Service/PreHandlers/SkipItems.php index b364192..2980f5d 100644 --- a/Service/PreHandlers/SkipItems.php +++ b/Service/PreHandlers/SkipItems.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Service/PreHandlers/SkipItems/SkippedItemFixer.php b/Service/PreHandlers/SkipItems/SkippedItemFixer.php index dc7085c..9651fb3 100644 --- a/Service/PreHandlers/SkipItems/SkippedItemFixer.php +++ b/Service/PreHandlers/SkipItems/SkippedItemFixer.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -32,7 +32,7 @@ class SkippedItemFixer public function __construct( DiscountHelperInterfaceFactory $discountHelperFactory, - ResultFactory $recalculateResultFactory + ResultFactory $recalculateResultFactory, ) { $this->discountHelperFactory = $discountHelperFactory; $this->recalculateResultFactory = $recalculateResultFactory; @@ -84,7 +84,7 @@ private function getDummyOrder($sourceItem): OrderInterface $sourceItem->getDiscountAmount(), $sourceItem->getQty(), $sourceItem->getTaxPercent(), - $taxAmount + $taxAmount, ); $item->addData($sourceItem->getData()); $item->setId($item->getItemId()); diff --git a/Service/PreHandlers/SkipItems/SkippedItemsCollector.php b/Service/PreHandlers/SkipItems/SkippedItemsCollector.php index 5a536d0..fe55ec4 100644 --- a/Service/PreHandlers/SkipItems/SkippedItemsCollector.php +++ b/Service/PreHandlers/SkipItems/SkippedItemsCollector.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -64,7 +64,7 @@ public function getItemIdsToSkip(OrderInterface $order): array static function ($item) { return (int) $item->getId(); }, - $items + $items, ); } } diff --git a/Service/RecalculatorFacade.php b/Service/RecalculatorFacade.php index 19e25da..cb0ef59 100644 --- a/Service/RecalculatorFacade.php +++ b/Service/RecalculatorFacade.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -54,7 +54,7 @@ public function __construct( Discount $discountHelper, ResultFactory $recalculateResultFactory, array $preHandlers = [], - array $postHandlers = [] + array $postHandlers = [], ) { $this->discountHelper = $discountHelper; $this->recalculateResultFactory = $recalculateResultFactory; @@ -73,7 +73,7 @@ public function execute( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { $this->resetHelper(); @@ -93,7 +93,7 @@ public function executeWithoutCalculation( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { $this->resetHelper(); $this->discountHelper->setDoCalculation(false); @@ -112,7 +112,7 @@ public function executeWithSpreading( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { $this->resetHelper(); $this->discountHelper->setSpreadDiscOnAllUnits(true); @@ -131,7 +131,7 @@ public function executeWithSplitting( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { $this->resetHelper(); $this->discountHelper->setIsSplitItemsAllowed(true); @@ -150,7 +150,7 @@ public function executeWithSpreadingAndSplitting( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { $this->resetHelper(); $this->discountHelper->setIsSplitItemsAllowed(true); @@ -170,7 +170,7 @@ public function executeWithoutGiftCardSpreading( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { $this->resetHelper(); $this->discountHelper->setIsAddGiftCardToPrice(false); @@ -189,7 +189,7 @@ public function executeWithoutRewardsSpreading( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { $this->resetHelper(); $this->discountHelper->setIsAddRewardsToPrice(false); @@ -208,7 +208,7 @@ public function executeWithoutExtraDiscountsSpreading( $shippingTaxValue = '', $markingAttributeCode = '', $markingListAttributeCode = '', - $markingRefundAttributeCode = '' + $markingRefundAttributeCode = '', ) { $this->resetHelper(); $this->discountHelper->setIsAddGiftCardToPrice(false); diff --git a/Test/Extra/DiscountHelperInterfaceFactory.php b/Test/Extra/DiscountHelperInterfaceFactory.php index 7f0b9c5..209500e 100644 --- a/Test/Extra/DiscountHelperInterfaceFactory.php +++ b/Test/Extra/DiscountHelperInterfaceFactory.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -26,7 +26,7 @@ class DiscountHelperInterfaceFactory extends \Mygento\Base\Api\DiscountHelperInt * @param \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager */ public function __construct( - \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager + \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager, ) { $this->_objectManager = $objectManager; } diff --git a/Test/Extra/ExpectedMaker.php b/Test/Extra/ExpectedMaker.php index 3dc8c35..e3235a7 100644 --- a/Test/Extra/ExpectedMaker.php +++ b/Test/Extra/ExpectedMaker.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Extra/GetRecalculateResultFactory.php b/Test/Extra/GetRecalculateResultFactory.php index bb7f9ad..18d49db 100644 --- a/Test/Extra/GetRecalculateResultFactory.php +++ b/Test/Extra/GetRecalculateResultFactory.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -27,13 +27,13 @@ public function get($testCase): ResultFactory /** @var \Mygento\Base\Test\Extra\RecalculateResultInterfaceFactory $recalculateResultFactory */ $recalculateResultFactory = $this->getObjectManager($testCase)->getObject( RecalculateResultInterfaceFactory::class, - ['objectManager' => $this->objectMan] + ['objectManager' => $this->objectMan], ); /** @var \Mygento\Base\Test\Extra\RecalculateResultItemInterfaceFactory $recalculateResultItemFactory */ $recalculateResultItemFactory = $this->getObjectManager($testCase)->getObject( RecalculateResultItemInterfaceFactory::class, - ['objectManager' => $this->objectMan] + ['objectManager' => $this->objectMan], ); return $this->getObjectManager($testCase)->getObject( @@ -41,7 +41,7 @@ public function get($testCase): ResultFactory [ 'resultInterfaceFactory' => $recalculateResultFactory, 'itemInterfaceFactory' => $recalculateResultItemFactory, - ] + ], ); } @@ -53,7 +53,7 @@ private function getObjectManager($testCase): ObjectManager { if (!$this->objectMan) { $this->objectMan = new ObjectManager( - $testCase + $testCase, ); } diff --git a/Test/Extra/RecalculateResultInterfaceFactory.php b/Test/Extra/RecalculateResultInterfaceFactory.php index d8394a0..ad6c5bc 100644 --- a/Test/Extra/RecalculateResultInterfaceFactory.php +++ b/Test/Extra/RecalculateResultInterfaceFactory.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -23,7 +23,7 @@ class RecalculateResultInterfaceFactory extends \Mygento\Base\Api\Data\Recalcula * @param \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager */ public function __construct( - \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager + \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager, ) { $this->_objectManager = $objectManager; } diff --git a/Test/Extra/RecalculateResultItemInterfaceFactory.php b/Test/Extra/RecalculateResultItemInterfaceFactory.php index 31024c6..452ed49 100644 --- a/Test/Extra/RecalculateResultItemInterfaceFactory.php +++ b/Test/Extra/RecalculateResultItemInterfaceFactory.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -23,7 +23,7 @@ class RecalculateResultItemInterfaceFactory extends \Mygento\Base\Api\Data\Recal * @param \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager */ public function __construct( - \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager + \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager, ) { $this->_objectManager = $objectManager; } diff --git a/Test/Extra/TableOutput.php b/Test/Extra/TableOutput.php index ea90ea1..ee06728 100644 --- a/Test/Extra/TableOutput.php +++ b/Test/Extra/TableOutput.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Extra/TestItemSkipper.php b/Test/Extra/TestItemSkipper.php index bd62523..1783343 100644 --- a/Test/Extra/TestItemSkipper.php +++ b/Test/Extra/TestItemSkipper.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/DiscountHelper/AffectsShippingTest.php b/Test/Unit/DiscountHelper/AffectsShippingTest.php index fd1092e..b85de23 100644 --- a/Test/Unit/DiscountHelper/AffectsShippingTest.php +++ b/Test/Unit/DiscountHelper/AffectsShippingTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/DiscountHelper/GeneralTestCase.php b/Test/Unit/DiscountHelper/GeneralTestCase.php index 1bbb929..2c1e25d 100644 --- a/Test/Unit/DiscountHelper/GeneralTestCase.php +++ b/Test/Unit/DiscountHelper/GeneralTestCase.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -78,7 +78,7 @@ public function getObjectManager(): ObjectManager { if (!$this->objectMan) { $this->objectMan = new ObjectManager( - $this + $this, ); } @@ -88,7 +88,7 @@ public function getObjectManager(): ObjectManager public function getDiscountHelperInstance() { $this->discountHelper = $this->getObjectManager()->getObject( - Discount::class + Discount::class, ); return $this->discountHelper; @@ -430,7 +430,7 @@ public function getOrders() $order->setData('gift_cards_amount', 1200); OrderMockBuilder::addItem( $order, - OrderMockBuilder::getItem(1000.0000, 1000.0000, 0, 1, 20)->setRowTotal(1000.0000)->setTaxAmount(200.0000) + OrderMockBuilder::getItem(1000.0000, 1000.0000, 0, 1, 20)->setRowTotal(1000.0000)->setTaxAmount(200.0000), ); $final[self::TEST_CASE_NAME_32] = $order; @@ -463,7 +463,7 @@ public function getOrders() OrderMockBuilder::getItem(54.0000, 54.0000, 8.1000, 1, 20.0000, 7.6500, 45.0000) ->setProductType('simple') ->setDiscountPercent(15.0) - ->setDiscountTaxCompensationAmount(1.35) + ->setDiscountTaxCompensationAmount(1.35), ); OrderMockBuilder::addItem( $order, @@ -484,7 +484,7 @@ public function getOrders() OrderMockBuilder::getItem(27.6000, 27.6000, 4.1400, 1, 20.0000, 3.9100, 23.0000) ->setProductType('simple') ->setDiscountTaxCompensationAmount(0.6900), - ]) + ]), ); $final[self::TEST_CASE_NAME_36] = $order; @@ -494,9 +494,7 @@ public function getOrders() /** * getExpected description */ - protected static function getExpected() - { - } + protected static function getExpected() {} protected function onNotSuccessfulTest(\Throwable $e): void { @@ -512,7 +510,7 @@ protected function getRecalculateResultFactory(): ResultFactory { /** @var \Mygento\Base\Test\Extra\GetRecalculateResultFactory $recalculateResultFactory */ $recalculateResultFactory = $this->getObjectManager()->getObject( - GetRecalculateResultFactory::class + GetRecalculateResultFactory::class, ); return $recalculateResultFactory->get($this); diff --git a/Test/Unit/DiscountHelper/MarkingItemsTest.php b/Test/Unit/DiscountHelper/MarkingItemsTest.php index 93d3349..9eb661f 100644 --- a/Test/Unit/DiscountHelper/MarkingItemsTest.php +++ b/Test/Unit/DiscountHelper/MarkingItemsTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -34,7 +34,7 @@ public function getItem( $discountAmount, $qty = 1, $taxPercent = 0, - $taxAmount = 0 + $taxAmount = 0, ) { $item = OrderMockBuilder::getItem($rowTotalInclTax, $priceInclTax, $discountAmount, $qty, $taxPercent, $taxAmount); @@ -273,9 +273,9 @@ public function dataProviderItemsForMarking() ',', array_map( 'base64_encode', - ['SOME_MARK_1', 'SOME_MARK_2', 'SOME_MARK_3'] - ) - ) + ['SOME_MARK_1', 'SOME_MARK_2', 'SOME_MARK_3'], + ), + ), ); $expected = [ diff --git a/Test/Unit/DiscountHelper/SplitItemsTest.php b/Test/Unit/DiscountHelper/SplitItemsTest.php index b0257b0..6c90b91 100644 --- a/Test/Unit/DiscountHelper/SplitItemsTest.php +++ b/Test/Unit/DiscountHelper/SplitItemsTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/DiscountHelper/SpreadAndSplitTest.php b/Test/Unit/DiscountHelper/SpreadAndSplitTest.php index a9e1d99..78b2b8c 100644 --- a/Test/Unit/DiscountHelper/SpreadAndSplitTest.php +++ b/Test/Unit/DiscountHelper/SpreadAndSplitTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/DiscountHelper/SpreadOnAllItemsTest.php b/Test/Unit/DiscountHelper/SpreadOnAllItemsTest.php index 6ca925b..3f7555d 100644 --- a/Test/Unit/DiscountHelper/SpreadOnAllItemsTest.php +++ b/Test/Unit/DiscountHelper/SpreadOnAllItemsTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/DiscountHelper/WithoutCalcTest.php b/Test/Unit/DiscountHelper/WithoutCalcTest.php index ebe3cb3..8daedb8 100644 --- a/Test/Unit/DiscountHelper/WithoutCalcTest.php +++ b/Test/Unit/DiscountHelper/WithoutCalcTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/DiscountHelper/WithoutExtraDiscountsInPrice.php b/Test/Unit/DiscountHelper/WithoutExtraDiscountsInPrice.php index ad31c83..506cca4 100644 --- a/Test/Unit/DiscountHelper/WithoutExtraDiscountsInPrice.php +++ b/Test/Unit/DiscountHelper/WithoutExtraDiscountsInPrice.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/Facade/AbstractFacadeTest.php b/Test/Unit/Facade/AbstractFacadeTest.php index 4eb7784..927d398 100644 --- a/Test/Unit/Facade/AbstractFacadeTest.php +++ b/Test/Unit/Facade/AbstractFacadeTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -34,7 +34,7 @@ protected function getRecalculateResultFactory(): ResultFactory { /** @var \Mygento\Base\Test\Extra\GetRecalculateResultFactory $recalculateResultFactory */ $recalculateResultFactory = $this->getObjectManager()->getObject( - GetRecalculateResultFactory::class + GetRecalculateResultFactory::class, ); return $recalculateResultFactory->get($this); @@ -48,7 +48,7 @@ protected function getDiscountHelperFactory(): DiscountHelperInterfaceFactory //Вместо моков нам нужны реальные объекты, которые участвуют в рассчете: return $this->getObjectManager()->getObject( DiscountHelperInterfaceFactory::class, - ['objectManager' => $this->getObjectManager()] + ['objectManager' => $this->getObjectManager()], ); } @@ -59,7 +59,7 @@ protected function getObjectManager(): ObjectManager { if (!$this->objectMan) { $this->objectMan = new ObjectManager( - $this + $this, ); } diff --git a/Test/Unit/Facade/AllHandlers/StepByStepBundleDataProvider.php b/Test/Unit/Facade/AllHandlers/StepByStepBundleDataProvider.php index 31d72dc..9ed133d 100644 --- a/Test/Unit/Facade/AllHandlers/StepByStepBundleDataProvider.php +++ b/Test/Unit/Facade/AllHandlers/StepByStepBundleDataProvider.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php b/Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php index 2f63d82..156b6ef 100644 --- a/Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php +++ b/Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -97,21 +97,21 @@ protected function getFacadeInstance(): RecalculatorFacade $resultFactory = $this->getRecalculateResultFactory(); $testItemSkipper = $this->getObjectManager()->getObject( - TestItemSkipper::class + TestItemSkipper::class, ); $skippedItemsCollector = $this->getObjectManager()->getObject( SkippedItemsCollector::class, [ 'skippers' => [$testItemSkipper], - ] + ], ); $skipItemsPreHandler = $this->getObjectManager()->getObject( SkipItems::class, [ 'skippedItemsCollector' => $skippedItemsCollector, - ] + ], ); return $this->getObjectManager()->getObject( @@ -121,7 +121,7 @@ protected function getFacadeInstance(): RecalculatorFacade 'recalculateResultFactory' => $resultFactory, 'preHandlers' => [$skipItemsPreHandler], 'postHandlers' => [], - ] + ], ); } @@ -131,7 +131,7 @@ private function getAddExtraDiscountsHandler(): AddExtraDiscounts AddExtraDiscounts::class, [ 'discountHelperFactory' => $this->getDiscountHelperFactory(), - ] + ], ); } @@ -142,7 +142,7 @@ private function getAddChildrenOfBundleHandler(): AddChildrenOfBundle [ 'discountHelperFactory' => $this->getDiscountHelperFactory(), 'recalculateResultFactory' => $this->getRecalculateResultFactory(), - ] + ], ); } @@ -178,7 +178,7 @@ private static function assertGiftCard(array $expectedItem, RecalculateResultIte private function assertVirtualOrderForBundles( OrderInterface $order, array $expectedVirtualOrders, - RecalculateResultInterface $recalculateResult + RecalculateResultInterface $recalculateResult, ): void { $addChildrenOfBundleHandler = $this->getAddChildrenOfBundleHandler(); $orderItems = $order->getAllVisibleItems() ?? $order->getAllItems(); @@ -193,7 +193,7 @@ private function assertVirtualOrderForBundles( $bundleOrder = $this->invokeMethod( $addChildrenOfBundleHandler, 'getDummyOrderBasedOnBundle', - [$orderItem, $recalculateResult] + [$orderItem, $recalculateResult], ); if (!$expectedVirtualOrder) { @@ -205,17 +205,17 @@ private function assertVirtualOrderForBundles( self::assertEquals( $expectedVirtualOrder->getSubtotalInclTax(), $bundleOrder->getSubtotalInclTax(), - 'Virtual order: SubtotalInclTax failed' + 'Virtual order: SubtotalInclTax failed', ); self::assertEquals( $expectedVirtualOrder->getSubtotal(), $bundleOrder->getSubtotal(), - 'Virtual order: Subtotal failed' + 'Virtual order: Subtotal failed', ); self::assertEquals( $expectedVirtualOrder->getGrandTotal(), $bundleOrder->getGrandTotal(), - 'Virtual order: GrandTotal failed' + 'Virtual order: GrandTotal failed', ); $expectedVirtualItems = $expectedVirtualOrder->getAllVisibleItems() ?? $expectedVirtualOrder->getAllItems(); @@ -226,27 +226,27 @@ private function assertVirtualOrderForBundles( self::assertEquals( $expectedItem->getPriceInclTax(), $item->getPriceInclTax(), - $name . ' Price of virtual item failed' + $name . ' Price of virtual item failed', ); self::assertEquals( $expectedItem->getRowTotalInclTax(), $item->getRowTotalInclTax(), - $name . ' RowTotalInclTax of virtual item failed' + $name . ' RowTotalInclTax of virtual item failed', ); self::assertEquals( $expectedItem->getQty(), $item->getQty(), - $name . ' Qty of virtual item failed' + $name . ' Qty of virtual item failed', ); self::assertEquals( $expectedItem->getTaxAmount(), $item->getTaxAmount(), - $name . ' TaxAmount of virtual item failed' + $name . ' TaxAmount of virtual item failed', ); self::assertEquals( $expectedItem->getDiscountAmount(), $item->getDiscountAmount(), - $name . ' DiscountAmount of virtual item failed' + $name . ' DiscountAmount of virtual item failed', ); } } diff --git a/Test/Unit/Facade/AllHandlersDataProvider.php b/Test/Unit/Facade/AllHandlersDataProvider.php index 1ca5025..6c8de69 100644 --- a/Test/Unit/Facade/AllHandlersDataProvider.php +++ b/Test/Unit/Facade/AllHandlersDataProvider.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/Facade/AllHandlersTest.php b/Test/Unit/Facade/AllHandlersTest.php index 920ff69..15bf43b 100644 --- a/Test/Unit/Facade/AllHandlersTest.php +++ b/Test/Unit/Facade/AllHandlersTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -82,24 +82,24 @@ protected function getFacadeInstance(): RecalculatorFacade [ 'discountHelperFactory' => $discountHelperFactory, 'recalculateResultFactory' => $resultFactory, - ] + ], ); $addExtraDiscountsHandler = $this->getObjectManager()->getObject( AddExtraDiscounts::class, [ 'discountHelperFactory' => $discountHelperFactory, - ] + ], ); $testItemSkipper = $this->getObjectManager()->getObject( - TestItemSkipper::class + TestItemSkipper::class, ); $skippedItemsCollector = $this->getObjectManager()->getObject( SkippedItemsCollector::class, [ 'skippers' => [$testItemSkipper], - ] + ], ); $skippedItemFixer = $this->getObjectManager()->getObject( @@ -107,7 +107,7 @@ protected function getFacadeInstance(): RecalculatorFacade [ 'discountHelperFactory' => $discountHelperFactory, 'recalculateResultFactory' => $resultFactory, - ] + ], ); $addRestoreSkipHandler = $this->getObjectManager()->getObject( @@ -115,14 +115,14 @@ protected function getFacadeInstance(): RecalculatorFacade [ 'skippedItemsCollector' => $skippedItemsCollector, 'skippedItemFixer' => $skippedItemFixer, - ] + ], ); $skipItemsPreHandler = $this->getObjectManager()->getObject( SkipItems::class, [ 'skippedItemsCollector' => $skippedItemsCollector, - ] + ], ); return $this->getObjectManager()->getObject( @@ -136,7 +136,7 @@ protected function getFacadeInstance(): RecalculatorFacade $addChildrenOfBundleHandler, $addRestoreSkipHandler, ], - ] + ], ); } } diff --git a/Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php b/Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php index ed4eeff..6cb4725 100644 --- a/Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php +++ b/Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -72,7 +72,7 @@ protected function getFacadeInstance(): RecalculatorFacade [ 'discountHelperFactory' => $discountHelperFactory, 'recalculateResultFactory' => $resultFactory, - ] + ], ); return $this->getObjectManager()->getObject( @@ -81,7 +81,7 @@ protected function getFacadeInstance(): RecalculatorFacade 'discountHelper' => $discountHelperFactory->create(), 'recalculateResultFactory' => $resultFactory, 'postHandlers' => [$addChildrenOfBundleHandler], - ] + ], ); } } diff --git a/Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php b/Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php index 2ded05c..fcef0c1 100644 --- a/Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php +++ b/Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -88,7 +88,7 @@ protected function getFacadeInstance(): RecalculatorFacade AddExtraDiscounts::class, [ 'discountHelperFactory' => $discountHelperFactory, - ] + ], ); return $this->getObjectManager()->getObject( @@ -97,7 +97,7 @@ protected function getFacadeInstance(): RecalculatorFacade 'discountHelper' => $discountHelperFactory->create(), 'recalculateResultFactory' => $this->getRecalculateResultFactory(), 'postHandlers' => [$addExtraDiscountsHandler], - ] + ], ); } } diff --git a/Test/Unit/Facade/Handlers/DataProvider/BundlesDataProvider.php b/Test/Unit/Facade/Handlers/DataProvider/BundlesDataProvider.php index ff66eb9..8a5ee8e 100644 --- a/Test/Unit/Facade/Handlers/DataProvider/BundlesDataProvider.php +++ b/Test/Unit/Facade/Handlers/DataProvider/BundlesDataProvider.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/Facade/Handlers/DataProvider/ExtraDiscountsDataProvider.php b/Test/Unit/Facade/Handlers/DataProvider/ExtraDiscountsDataProvider.php index 8dfb3bd..66201ed 100644 --- a/Test/Unit/Facade/Handlers/DataProvider/ExtraDiscountsDataProvider.php +++ b/Test/Unit/Facade/Handlers/DataProvider/ExtraDiscountsDataProvider.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/Facade/Handlers/DataProvider/SkipItemsDataProvider.php b/Test/Unit/Facade/Handlers/DataProvider/SkipItemsDataProvider.php index 85390d5..8272d6c 100644 --- a/Test/Unit/Facade/Handlers/DataProvider/SkipItemsDataProvider.php +++ b/Test/Unit/Facade/Handlers/DataProvider/SkipItemsDataProvider.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerDataProvider.php b/Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerDataProvider.php index 3dcab5c..915bfcb 100644 --- a/Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerDataProvider.php +++ b/Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerDataProvider.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerTest.php b/Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerTest.php index a3f3664..aabe737 100644 --- a/Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerTest.php +++ b/Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -50,7 +50,7 @@ public function getObjectManager(): ObjectManager { if (!$this->objectMan) { $this->objectMan = new ObjectManager( - $this + $this, ); } @@ -65,7 +65,7 @@ private function getFixerInstance() /** @var \Mygento\Base\Test\Extra\DiscountHelperInterfaceFactory $discountHelperFactory */ $discountHelperFactory = $this->getObjectManager()->getObject( DiscountHelperInterfaceFactory::class, - ['objectManager' => $this->objectMan] + ['objectManager' => $this->objectMan], ); $resultFactory = $this->getRecalculateResultFactory(); @@ -75,7 +75,7 @@ private function getFixerInstance() [ 'discountHelperFactory' => $discountHelperFactory, 'recalculateResultFactory' => $resultFactory, - ] + ], ); } @@ -86,7 +86,7 @@ private function getRecalculateResultFactory(): ResultFactory { /** @var \Mygento\Base\Test\Extra\GetRecalculateResultFactory $recalculateResultFactory */ $recalculateResultFactory = $this->getObjectManager()->getObject( - GetRecalculateResultFactory::class + GetRecalculateResultFactory::class, ); return $recalculateResultFactory->get($this); diff --git a/Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php b/Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php index 763cf7b..2a20545 100644 --- a/Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php +++ b/Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -72,17 +72,17 @@ public function testVirtualOrder($order, array $expected, OrderInterface $expect self::assertEquals( $expectedVirtualOrder->getSubtotalInclTax(), $virtualOrder->getSubtotalInclTax(), - 'Virtual order: SubtotalInclTax failed' + 'Virtual order: SubtotalInclTax failed', ); self::assertEquals( $expectedVirtualOrder->getGrandTotal(), $virtualOrder->getGrandTotal(), - 'Virtual order: GrandTotal failed' + 'Virtual order: GrandTotal failed', ); self::assertEquals( $expectedVirtualOrder->getDiscountAmount(), $virtualOrder->getDiscountAmount(), - 'Virtual order: Discount Amount failed' + 'Virtual order: Discount Amount failed', ); } @@ -100,28 +100,28 @@ protected function getFacadeInstance(): RecalculatorFacade 'discountHelper' => $discountHelperFactory->create(), 'recalculateResultFactory' => $this->getRecalculateResultFactory(), 'preHandlers' => [$skipItemsPreHandler], - ] + ], ); } protected function getSkipItemsHandler(): SkipItems { $testItemSkipper = $this->getObjectManager()->getObject( - TestItemSkipper::class + TestItemSkipper::class, ); $skippedItemsCollector = $this->getObjectManager()->getObject( SkippedItemsCollector::class, [ 'skippers' => [$testItemSkipper], - ] + ], ); return $this->getObjectManager()->getObject( SkipItems::class, [ 'skippedItemsCollector' => $skippedItemsCollector, - ] + ], ); } } diff --git a/Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php b/Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php index 2177caa..a783e2a 100644 --- a/Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php +++ b/Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ diff --git a/Test/framework/autoload.php b/Test/framework/autoload.php index a6e722b..7e009d3 100644 --- a/Test/framework/autoload.php +++ b/Test/framework/autoload.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -16,7 +16,7 @@ $generatorIo = new Io( new File(), - TESTS_TEMP_DIR . '/' . DirectoryList::getDefaultConfig()[DirectoryList::GENERATED_CODE][DirectoryList::PATH] + TESTS_TEMP_DIR . '/' . DirectoryList::getDefaultConfig()[DirectoryList::GENERATED_CODE][DirectoryList::PATH], ); $generatedCodeAutoloader = new GeneratedClassesAutoloader( [ @@ -24,6 +24,6 @@ new ExtensionAttributesInterfaceGenerator(), new FactoryGenerator(), ], - $generatorIo + $generatorIo, ); spl_autoload_register([$generatedCodeAutoloader, 'load']); diff --git a/Test/framework/bootstrap.php b/Test/framework/bootstrap.php index ab8b447..7dec46c 100644 --- a/Test/framework/bootstrap.php +++ b/Test/framework/bootstrap.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -53,9 +53,9 @@ function ($errNo, $errStr, $errFile, $errLine) { throw new \PHPUnit\Framework\Exception( sprintf('%s: %s in %s:%s.', $errName, $errStr, $errFile, $errLine), - $errNo + $errNo, ); } - } + }, ); } diff --git a/Ui/Component/Listing/Actions.php b/Ui/Component/Listing/Actions.php index 277f87d..22067a4 100644 --- a/Ui/Component/Listing/Actions.php +++ b/Ui/Component/Listing/Actions.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -37,7 +37,7 @@ public function __construct( \Magento\Framework\View\Element\UiComponent\ContextInterface $context, \Magento\Framework\View\Element\UiComponentFactory $uiComponentFactory, array $components = [], - array $data = [] + array $data = [], ) { parent::__construct($context, $uiComponentFactory, $components, $data); $this->urlBuilder = $urlBuilder; @@ -60,7 +60,7 @@ public function prepareDataSource(array $dataSource) $this->route . '/' . $this->controller . '/edit', [ 'id' => $item[$this->key], - ] + ], ), 'label' => __('Edit'), ], @@ -69,7 +69,7 @@ public function prepareDataSource(array $dataSource) $this->route . '/' . $this->controller . '/delete', [ 'id' => $item[$this->key], - ] + ], ), 'label' => __('Delete'), 'confirm' => [ diff --git a/Ui/Component/Listing/Thumbnail.php b/Ui/Component/Listing/Thumbnail.php index 808176e..329c2a4 100644 --- a/Ui/Component/Listing/Thumbnail.php +++ b/Ui/Component/Listing/Thumbnail.php @@ -2,7 +2,7 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ @@ -49,7 +49,7 @@ public function __construct( \Magento\Framework\View\Element\UiComponent\ContextInterface $context, \Magento\Framework\View\Element\UiComponentFactory $uiComponentFactory, array $components = [], - array $data = [] + array $data = [], ) { parent::__construct($context, $uiComponentFactory, $components, $data); $this->imageHelper = $imageHelper; @@ -78,7 +78,7 @@ public function prepareDataSource(array $dataSource) $image, $this->baseUrl, $this->data['thumbnail']['viewId'], - $this->data['thumbnail']['moduleName'] + $this->data['thumbnail']['moduleName'], ); $item[$fieldName . '_src'] = $thumbnailUrl; @@ -87,7 +87,7 @@ public function prepareDataSource(array $dataSource) $this->route . '/' . $this->controller . '/edit', [ 'id' => $item[$this->key], - ] + ], ); $item[$fieldName . '_orig_src'] = $imageUrl; } diff --git a/composer.json b/composer.json index 13593a3..2617eaf 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require": { "php": ">=8.0.0", "ext-bcmath": "*", - "magento/framework": "103.*", + "magento/framework": "^103.0.8", "magento/module-sales": "103.*" }, "require-dev": { diff --git a/registration.php b/registration.php index 21240e3..7d00826 100644 --- a/registration.php +++ b/registration.php @@ -2,12 +2,12 @@ /** * @author Mygento Team - * @copyright 2014-2021 Mygento (https://www.mygento.ru) + * @copyright 2014-2025 Mygento (https://www.mygento.com) * @package Mygento_Base */ \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Mygento_Base', - __DIR__ + __DIR__, ); From 279ff01d81b9d3141ccef1b1de94fcc303699501 Mon Sep 17 00:00:00 2001 From: Nikita Date: Tue, 9 Sep 2025 11:58:51 +0200 Subject: [PATCH 2/4] fixer --- .php-cs-fixer.php | 2 +- Api/Data/EventInterface.php | 2 +- Api/Data/EventSearchResultsInterface.php | 2 +- Api/Data/PaymentInterface.php | 2 +- Api/Data/RecalculateResultInterface.php | 2 +- Api/Data/RecalculateResultItemInterface.php | 2 +- Api/DiscountHelperInterface.php | 2 +- Api/EventRepositoryInterface.php | 2 +- Api/ItemSkipper.php | 2 +- Api/ProductAttributeHelperInterface.php | 2 +- Api/RecalculationPostHandlerInterface.php | 2 +- Api/RecalculationPreHandlerInterface.php | 2 +- Api/RecalculatorFacadeInterface.php | 2 +- Block/Adminhtml/Component/Edit/BackButton.php | 2 +- Block/Adminhtml/Component/Edit/DeleteButton.php | 2 +- Block/Adminhtml/Component/Edit/GenericButton.php | 2 +- Block/Adminhtml/Component/Edit/ResetButton.php | 2 +- Block/Adminhtml/Component/Edit/SaveAndContinueButton.php | 2 +- Block/Adminhtml/Component/Edit/SaveButton.php | 2 +- Block/Adminhtml/System/Config/AjaxButton.php | 2 +- Block/Adminhtml/System/Config/CronButton.php | 2 +- Block/Extensions.php | 2 +- Controller/Adminhtml/Cron/Schedule.php | 2 +- Controller/Adminhtml/Event.php | 2 +- Controller/Adminhtml/Event/Index.php | 2 +- Helper/Cron.php | 2 +- Helper/Currency.php | 2 +- Helper/Data.php | 2 +- Helper/Discount.php | 2 +- Helper/Discount/Math.php | 2 +- Helper/Discount/Tax.php | 2 +- Helper/Image.php | 2 +- Helper/Product/Attribute.php | 2 +- Model/Config/Backend/File.php | 2 +- Model/Event.php | 2 +- Model/Event/DataProvider.php | 2 +- Model/EventRepository.php | 2 +- Model/ImageUploader.php | 2 +- Model/LogManager.php | 2 +- Model/Logger/Database.php | 2 +- Model/Logger/Handler.php | 2 +- Model/Logger/Logger.php | 2 +- Model/Mock/OrderItemMock.php | 2 +- Model/Mock/OrderMock.php | 2 +- Model/Mock/OrderMockBuilder.php | 2 +- Model/Mock/OrderPaymentMock.php | 2 +- Model/OrderRepository.php | 2 +- Model/Payment/Transaction.php | 2 +- Model/Recalculator/Result.php | 2 +- Model/Recalculator/Result/Item.php | 2 +- Model/Recalculator/ResultFactory.php | 2 +- Model/ResourceModel/Event.php | 2 +- Model/ResourceModel/Event/Collection.php | 2 +- Model/ResourceModel/Event/Grid/Collection.php | 2 +- Model/Source/AbstractAttributes.php | 2 +- Model/Source/Attributes.php | 2 +- Model/Source/LogTarget.php | 2 +- Model/Source/Loglevel.php | 2 +- Model/Source/OrderItem.php | 2 +- Model/Source/Payments.php | 2 +- Model/Source/State.php | 2 +- Model/Source/Status.php | 2 +- Plugin/Transaction.php | 2 +- Service/PostHandlers/AddChildrenOfBundle.php | 2 +- Service/PostHandlers/AddExtraDiscounts.php | 2 +- Service/PostHandlers/RestoreSkippedItems.php | 2 +- Service/PreHandlers/SkipItems.php | 2 +- Service/PreHandlers/SkipItems/SkippedItemFixer.php | 2 +- Service/PreHandlers/SkipItems/SkippedItemsCollector.php | 2 +- Service/RecalculatorFacade.php | 2 +- Test/Extra/DiscountHelperInterfaceFactory.php | 2 +- Test/Extra/ExpectedMaker.php | 2 +- Test/Extra/GetRecalculateResultFactory.php | 2 +- Test/Extra/RecalculateResultInterfaceFactory.php | 2 +- Test/Extra/RecalculateResultItemInterfaceFactory.php | 2 +- Test/Extra/TableOutput.php | 2 +- Test/Extra/TestItemSkipper.php | 2 +- Test/Unit/DiscountHelper/AffectsShippingTest.php | 2 +- Test/Unit/DiscountHelper/GeneralTestCase.php | 2 +- Test/Unit/DiscountHelper/MarkingItemsTest.php | 2 +- Test/Unit/DiscountHelper/SplitItemsTest.php | 2 +- Test/Unit/DiscountHelper/SpreadAndSplitTest.php | 2 +- Test/Unit/DiscountHelper/SpreadOnAllItemsTest.php | 2 +- Test/Unit/DiscountHelper/WithoutCalcTest.php | 2 +- Test/Unit/DiscountHelper/WithoutExtraDiscountsInPrice.php | 2 +- Test/Unit/Facade/AbstractFacadeTest.php | 2 +- Test/Unit/Facade/AllHandlers/StepByStepBundleDataProvider.php | 2 +- Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php | 2 +- Test/Unit/Facade/AllHandlersDataProvider.php | 2 +- Test/Unit/Facade/AllHandlersTest.php | 2 +- Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php | 2 +- Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php | 2 +- Test/Unit/Facade/Handlers/DataProvider/BundlesDataProvider.php | 2 +- .../Facade/Handlers/DataProvider/ExtraDiscountsDataProvider.php | 2 +- .../Unit/Facade/Handlers/DataProvider/SkipItemsDataProvider.php | 2 +- .../Facade/Handlers/SkipItem/SkippedItemFixerDataProvider.php | 2 +- Test/Unit/Facade/Handlers/SkipItem/SkippedItemFixerTest.php | 2 +- Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php | 2 +- Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php | 2 +- Test/framework/autoload.php | 2 +- Test/framework/bootstrap.php | 2 +- Ui/Component/Listing/Actions.php | 2 +- Ui/Component/Listing/Thumbnail.php | 2 +- registration.php | 2 +- 104 files changed, 104 insertions(+), 104 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 0f44c27..3172252 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,7 +1,7 @@ Date: Tue, 9 Sep 2025 12:14:26 +0200 Subject: [PATCH 3/4] phpunit --- Test/Unit/DiscountHelper/GeneralTestCase.php | 2 +- .../Facade/{AbstractFacadeTest.php => AbstractTestFacade.php} | 2 +- Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php | 4 ++-- Test/Unit/Facade/AllHandlersTest.php | 2 +- Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php | 4 ++-- Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php | 4 ++-- Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php | 4 ++-- Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) rename Test/Unit/Facade/{AbstractFacadeTest.php => AbstractTestFacade.php} (97%) diff --git a/Test/Unit/DiscountHelper/GeneralTestCase.php b/Test/Unit/DiscountHelper/GeneralTestCase.php index 9c6d963..bf17f21 100644 --- a/Test/Unit/DiscountHelper/GeneralTestCase.php +++ b/Test/Unit/DiscountHelper/GeneralTestCase.php @@ -496,7 +496,7 @@ public function getOrders() */ protected static function getExpected() {} - protected function onNotSuccessfulTest(\Throwable $e): void + protected function onNotSuccessfulTest(\Throwable $e): never { //beautify output echo "\033[1;31m"; // light red diff --git a/Test/Unit/Facade/AbstractFacadeTest.php b/Test/Unit/Facade/AbstractTestFacade.php similarity index 97% rename from Test/Unit/Facade/AbstractFacadeTest.php rename to Test/Unit/Facade/AbstractTestFacade.php index d0def60..149499e 100644 --- a/Test/Unit/Facade/AbstractFacadeTest.php +++ b/Test/Unit/Facade/AbstractTestFacade.php @@ -15,7 +15,7 @@ use Mygento\Base\Test\Extra\GetRecalculateResultFactory; use PHPUnit\Framework\TestCase; -abstract class AbstractFacadeTest extends TestCase +abstract class AbstractTestFacade extends TestCase { /** * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager diff --git a/Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php b/Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php index 397b90d..d6e59e3 100644 --- a/Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php +++ b/Test/Unit/Facade/AllHandlers/StepByStepBundleTest.php @@ -21,9 +21,9 @@ use Mygento\Base\Test\Extra\ExpectedMaker; use Mygento\Base\Test\Extra\TableOutput; use Mygento\Base\Test\Extra\TestItemSkipper; -use Mygento\Base\Test\Unit\Facade\AbstractFacadeTest; +use Mygento\Base\Test\Unit\Facade\AbstractTestFacade; -class StepByStepBundleTest extends AbstractFacadeTest +class StepByStepBundleTest extends AbstractTestFacade { /** * @dataProvider \Mygento\Base\Test\Unit\Facade\AllHandlers\StepByStepBundleDataProvider::provide diff --git a/Test/Unit/Facade/AllHandlersTest.php b/Test/Unit/Facade/AllHandlersTest.php index 416abfc..1e1bd9e 100644 --- a/Test/Unit/Facade/AllHandlersTest.php +++ b/Test/Unit/Facade/AllHandlersTest.php @@ -20,7 +20,7 @@ use Mygento\Base\Test\Extra\TableOutput; use Mygento\Base\Test\Extra\TestItemSkipper; -class AllHandlersTest extends AbstractFacadeTest +class AllHandlersTest extends AbstractTestFacade { /** * @dataProvider \Mygento\Base\Test\Unit\Facade\AllHandlersDataProvider::dataProvider diff --git a/Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php b/Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php index 15c6465..485df1f 100644 --- a/Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php +++ b/Test/Unit/Facade/Handlers/AddChildrenOfBundleHandlerTest.php @@ -13,9 +13,9 @@ use Mygento\Base\Service\RecalculatorFacade; use Mygento\Base\Test\Extra\ExpectedMaker; use Mygento\Base\Test\Extra\TableOutput; -use Mygento\Base\Test\Unit\Facade\AbstractFacadeTest; +use Mygento\Base\Test\Unit\Facade\AbstractTestFacade; -class AddChildrenOfBundleHandlerTest extends AbstractFacadeTest +class AddChildrenOfBundleHandlerTest extends AbstractTestFacade { /** * @dataProvider \Mygento\Base\Test\Unit\Facade\Handlers\DataProvider\BundlesDataProvider::dataProviderBundles diff --git a/Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php b/Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php index 9956714..9b67fdb 100644 --- a/Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php +++ b/Test/Unit/Facade/Handlers/AddExtraDiscountsHandlerTest.php @@ -12,9 +12,9 @@ use Mygento\Base\Service\PostHandlers\AddExtraDiscounts; use Mygento\Base\Service\RecalculatorFacade; use Mygento\Base\Test\Extra\ExpectedMaker; -use Mygento\Base\Test\Unit\Facade\AbstractFacadeTest; +use Mygento\Base\Test\Unit\Facade\AbstractTestFacade; -class AddExtraDiscountsHandlerTest extends AbstractFacadeTest +class AddExtraDiscountsHandlerTest extends AbstractTestFacade { /** * @dataProvider \Mygento\Base\Test\Unit\Facade\Handlers\DataProvider\ExtraDiscountsDataProvider::dataProvider diff --git a/Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php b/Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php index 88ca976..ed8c1c7 100644 --- a/Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php +++ b/Test/Unit/Facade/Handlers/SkipItemsHandlerTest.php @@ -15,9 +15,9 @@ use Mygento\Base\Test\Extra\ExpectedMaker; use Mygento\Base\Test\Extra\TableOutput; use Mygento\Base\Test\Extra\TestItemSkipper; -use Mygento\Base\Test\Unit\Facade\AbstractFacadeTest; +use Mygento\Base\Test\Unit\Facade\AbstractTestFacade; -class SkipItemsHandlerTest extends AbstractFacadeTest +class SkipItemsHandlerTest extends AbstractTestFacade { /** * @dataProvider \Mygento\Base\Test\Unit\Facade\Handlers\DataProvider\SkipItemsDataProvider::dataProvider() diff --git a/Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php b/Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php index e6f2c6d..3ef9b12 100644 --- a/Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php +++ b/Test/Unit/TaxHelper/DiscountAmountInclTaxTest.php @@ -127,7 +127,7 @@ protected static function getExpected() ]; } - protected function onNotSuccessfulTest(\Throwable $e): void + protected function onNotSuccessfulTest(\Throwable $e): never { //beautify output echo "\033[1;31m"; // light red From 496d78d81f7c255d9d281ba22998c2ef99f5bf91 Mon Sep 17 00:00:00 2001 From: Nikita Date: Tue, 9 Sep 2025 12:44:13 +0200 Subject: [PATCH 4/4] monolog --- .jeeves.yaml | 93 ++++++------- Api/Data/EventInterface.php | 55 +++----- Api/Data/EventSearchResultsInterface.php | 4 +- Api/EventRepositoryInterface.php | 22 +-- Controller/Adminhtml/Cron/Schedule.php | 2 +- Controller/Adminhtml/Event.php | 49 ++----- Controller/Adminhtml/Event/Index.php | 42 +++--- Helper/Currency.php | 5 - Model/Config/Backend/File.php | 64 +++------ Model/Event.php | 63 +++------ Model/Event/DataProvider.php | 40 +++--- Model/EventRepository.php | 125 ++++++------------ Model/EventSearchResults.php | 14 ++ Model/Logger/Database.php | 53 +++----- Model/Logger/Handler.php | 13 +- Model/Logger/Logger.php | 5 +- Model/Mock/OrderMock.php | 11 +- Model/ResourceModel/Event.php | 10 +- Model/ResourceModel/Event/Collection.php | 12 +- Model/ResourceModel/Event/Grid/Collection.php | 37 +++--- Model/Source/Loglevel.php | 11 +- Test/Extra/TableOutput.php | 4 +- Test/framework/bootstrap.php | 1 - composer.json | 2 +- etc/db_schema.xml | 10 +- etc/di.xml | 22 ++- grumphp.yml | 1 + .../ui_component/base_event_listing.xml | 17 +++ 28 files changed, 319 insertions(+), 468 deletions(-) create mode 100644 Model/EventSearchResults.php diff --git a/.jeeves.yaml b/.jeeves.yaml index 02a8cef..dff2779 100644 --- a/.jeeves.yaml +++ b/.jeeves.yaml @@ -1,47 +1,50 @@ Mygento: Base: - Event: - readonly: true - columns: - id: - type: bigint - pk: true - identity: true - unsigned: true - nullable: false - comment: 'Event ID' - instance: - type: varchar - nullable: false - comment: 'Server' - channel: - type: varchar - nullable: false - comment: 'Channel' - level: - type: int - unsigned: true - nullable: false - comment: 'level' - source: 'Mygento\Base\Model\Source\Loglevel' - message: - type: text - nullable: false - comment: 'log datetime' - logged_at: - type: datetime - nullable: false - comment: 'message' - context: - type: text - comment: 'context' - extra: - type: text - comment: 'extra' - indexes: - IX_EVENT_INST: - columns: ['instance'] - IX_EVENT_CHAN: - columns: ['channel'] - IX_EVENT_LVL: - columns: ['level'] + settings: + php_version: 8.2 + entities: + Event: + readonly: true + columns: + id: + type: bigint + pk: true + identity: true + unsigned: true + nullable: false + comment: 'Event ID' + instance: + type: varchar + nullable: false + comment: 'Server' + channel: + type: varchar + nullable: false + comment: 'Channel' + level: + type: int + unsigned: true + nullable: false + comment: 'level' + source: 'Mygento\Base\Model\Source\Loglevel' + message: + type: text + nullable: false + comment: 'log datetime' + logged_at: + type: datetime + nullable: false + comment: 'message' + context: + type: text + comment: 'context' + extra: + type: text + comment: 'extra' + indexes: + IX_EVENT_INST: + columns: ['instance'] + IX_EVENT_CHAN: + columns: ['channel'] + IX_EVENT_LVL: + columns: ['level'] diff --git a/Api/Data/EventInterface.php b/Api/Data/EventInterface.php index 5ebe30f..e6945d3 100644 --- a/Api/Data/EventInterface.php +++ b/Api/Data/EventInterface.php @@ -21,105 +21,82 @@ interface EventInterface /** * Get id - * @return int|null */ - public function getId(); + public function getId(): ?int; /** * Set id * @param int $id - * @return $this */ - public function setId($id); + public function setId($id): self; /** * Get instance - * @return string|null */ - public function getInstance(); + public function getInstance(): string; /** * Set instance - * @param string $instance - * @return $this */ - public function setInstance($instance); + public function setInstance(string $instance): self; /** * Get channel - * @return string|null */ - public function getChannel(); + public function getChannel(): string; /** * Set channel - * @param string $channel - * @return $this */ - public function setChannel($channel); + public function setChannel(string $channel): self; /** * Get level - * @return int|null */ - public function getLevel(); + public function getLevel(): int; /** * Set level - * @param int $level - * @return $this */ - public function setLevel($level); + public function setLevel(int $level): self; /** * Get message - * @return string|null */ - public function getMessage(); + public function getMessage(): string; /** * Set message - * @param string $message - * @return $this */ - public function setMessage($message); + public function setMessage(string $message): self; /** * Get logged at - * @return string|null */ - public function getLoggedAt(); + public function getLoggedAt(): string; /** * Set logged at - * @param string $loggedAt - * @return $this */ - public function setLoggedAt($loggedAt); + public function setLoggedAt(string $loggedAt): self; /** * Get context - * @return string|null */ - public function getContext(); + public function getContext(): ?string; /** * Set context - * @param string $context - * @return $this */ - public function setContext($context); + public function setContext(?string $context): self; /** * Get extra - * @return string|null */ - public function getExtra(); + public function getExtra(): ?string; /** * Set extra - * @param string $extra - * @return $this */ - public function setExtra($extra); + public function setExtra(?string $extra): self; } diff --git a/Api/Data/EventSearchResultsInterface.php b/Api/Data/EventSearchResultsInterface.php index 776087d..cf7874d 100644 --- a/Api/Data/EventSearchResultsInterface.php +++ b/Api/Data/EventSearchResultsInterface.php @@ -8,7 +8,9 @@ namespace Mygento\Base\Api\Data; -interface EventSearchResultsInterface extends \Magento\Framework\Api\SearchResultsInterface +use Magento\Framework\Api\SearchResultsInterface; + +interface EventSearchResultsInterface extends SearchResultsInterface { /** * Get list of Event diff --git a/Api/EventRepositoryInterface.php b/Api/EventRepositoryInterface.php index 5c412af..3eeb5c7 100644 --- a/Api/EventRepositoryInterface.php +++ b/Api/EventRepositoryInterface.php @@ -8,46 +8,38 @@ namespace Mygento\Base\Api; +use Magento\Framework\Api\SearchCriteriaInterface; + interface EventRepositoryInterface { /** * Save Event - * @param \Mygento\Base\Api\Data\EventInterface $entity * @throws \Magento\Framework\Exception\LocalizedException - * @return \Mygento\Base\Api\Data\EventInterface */ - public function save(Data\EventInterface $entity); + public function save(Data\EventInterface $entity): Data\EventInterface; /** * Retrieve Event - * @param int $entityId * @throws \Magento\Framework\Exception\LocalizedException - * @return \Mygento\Base\Api\Data\EventInterface */ - public function getById($entityId); + public function getById(int $entityId): Data\EventInterface; /** * Retrieve Event entities matching the specified criteria - * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @throws \Magento\Framework\Exception\LocalizedException - * @return \Mygento\Base\Api\Data\EventSearchResultsInterface */ - public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); + public function getList(SearchCriteriaInterface $searchCriteria): Data\EventSearchResultsInterface; /** * Delete Event - * @param \Mygento\Base\Api\Data\EventInterface $entity * @throws \Magento\Framework\Exception\LocalizedException - * @return bool true on success */ - public function delete(Data\EventInterface $entity); + public function delete(Data\EventInterface $entity): bool; /** * Delete Event - * @param int $entityId * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\LocalizedException - * @return bool true on success */ - public function deleteById($entityId); + public function deleteById(int $entityId): bool; } diff --git a/Controller/Adminhtml/Cron/Schedule.php b/Controller/Adminhtml/Cron/Schedule.php index 1b31172..5e16a3d 100644 --- a/Controller/Adminhtml/Cron/Schedule.php +++ b/Controller/Adminhtml/Cron/Schedule.php @@ -37,7 +37,7 @@ public function __construct( /** * Execute action based on request and return result - * @return \Magento\Framework\Controller\ResultInterface|ResponseInterface + * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface */ public function execute() { diff --git a/Controller/Adminhtml/Event.php b/Controller/Adminhtml/Event.php index f33288a..87d7bcf 100644 --- a/Controller/Adminhtml/Event.php +++ b/Controller/Adminhtml/Event.php @@ -8,55 +8,24 @@ namespace Mygento\Base\Controller\Adminhtml; -abstract class Event extends \Magento\Backend\App\Action +use Magento\Backend\App\Action; +use Magento\Framework\Registry; +use Mygento\Base\Api\EventRepositoryInterface; + +abstract class Event extends Action { /** * Authorization level * * @see _isAllowed() */ - public const ADMIN_RESOURCE = 'Mygento_Base::base_event'; - - /** - * Core registry - * - * @var \Magento\Framework\Registry - */ - protected $coreRegistry; - - /** - * Event repository - * - * @var \Mygento\Base\Api\EventRepositoryInterface - */ - protected $repository; + public const ADMIN_RESOURCE = 'Mygento_Base::event'; - /** - * @param \Mygento\Base\Api\EventRepositoryInterface $repository - * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Backend\App\Action\Context $context - */ public function __construct( - \Mygento\Base\Api\EventRepositoryInterface $repository, - \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context, + protected readonly EventRepositoryInterface $repository, + protected readonly Registry $coreRegistry, + Action\Context $context, ) { parent::__construct($context); - $this->repository = $repository; - $this->coreRegistry = $coreRegistry; - } - - /** - * Init page - * - * @param \Magento\Backend\Model\View\Result\Page $resultPage - * @return \Magento\Backend\Model\View\Result\Page - */ - protected function initPage($resultPage) - { - $resultPage->setActiveMenu('Mygento_Base::event'); - - //->addBreadcrumb(__('Event'), __('Event')); - return $resultPage; } } diff --git a/Controller/Adminhtml/Event/Index.php b/Controller/Adminhtml/Event/Index.php index 0bbe9d2..03e47d4 100644 --- a/Controller/Adminhtml/Event/Index.php +++ b/Controller/Adminhtml/Event/Index.php @@ -8,40 +8,40 @@ namespace Mygento\Base\Controller\Adminhtml\Event; -class Index extends \Mygento\Base\Controller\Adminhtml\Event -{ - /** @var \Magento\Framework\View\Result\PageFactory */ - private $resultPageFactory; +use Magento\Backend\App\Action\Context; +use Magento\Framework\App\Request\DataPersistorInterface; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\Registry; +use Magento\Framework\View\Result\PageFactory; +use Mygento\Base\Api\EventRepositoryInterface; +use Mygento\Base\Controller\Adminhtml\Event; - /** - * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory - * @param \Mygento\Base\Api\EventRepositoryInterface $repository - * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Backend\App\Action\Context $context - */ +class Index extends Event +{ public function __construct( - \Magento\Framework\View\Result\PageFactory $resultPageFactory, - \Mygento\Base\Api\EventRepositoryInterface $repository, - \Magento\Framework\Registry $coreRegistry, - \Magento\Backend\App\Action\Context $context, + private readonly PageFactory $resultPageFactory, + private readonly DataPersistorInterface $dataPersistor, + EventRepositoryInterface $repository, + Registry $coreRegistry, + Context $context, ) { - $this->resultPageFactory = $resultPageFactory; parent::__construct($repository, $coreRegistry, $context); } /** * Index action - * - * @return \Magento\Framework\Controller\ResultInterface */ - public function execute() + public function execute(): ResultInterface { /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); - $this->initPage($resultPage)->getConfig()->getTitle()->prepend(__('Event')); + $resultPage + ->setActiveMenu('Mygento_Base::event') + ->getConfig() + ->getTitle()->prepend(__('Event')->render()); + + $this->dataPersistor->clear('base_event'); - //$dataPersistor = $this->_objectManager->get(\Magento\Framework\App\Request\DataPersistorInterface::class); - //$dataPersistor->clear('base_event'); return $resultPage; } } diff --git a/Helper/Currency.php b/Helper/Currency.php index 7741c12..ab7be32 100644 --- a/Helper/Currency.php +++ b/Helper/Currency.php @@ -20,11 +20,6 @@ class Currency extends \Magento\Framework\App\Helper\AbstractHelper */ private $currencyFactory; - /** - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Framework\App\Helper\Context $context - */ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\CurrencyFactory $currencyFactory, diff --git a/Model/Config/Backend/File.php b/Model/Config/Backend/File.php index 1555fe9..80382e2 100644 --- a/Model/Config/Backend/File.php +++ b/Model/Config/Backend/File.php @@ -9,9 +9,16 @@ namespace Mygento\Base\Model\Config\Backend; use Magento\Config\Model\Config\Backend\File\RequestData\RequestDataInterface; +use Magento\Framework\App\Cache\TypeListInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Data\Collection\AbstractDb; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\File\UploaderFactory; +use Magento\Framework\Filesystem; +use Magento\Framework\Model\Context; +use Magento\Framework\Model\ResourceModel\AbstractResource; +use Magento\Framework\Registry; /** * @method getFieldConfig() @@ -28,50 +35,17 @@ class File extends \Magento\Framework\App\Config\Value */ protected $maxFileSize = 0; - /** - * @var \Magento\Config\Model\Config\Backend\File\RequestData\RequestDataInterface - */ - private $requestData; - - /** - * @var \Magento\Framework\Filesystem - */ - private $filesystem; - - /** - * @var \Magento\Framework\Filesystem\DirectoryList - */ - private $directoryList; - - /** - * @var \Magento\Framework\File\UploaderFactory - */ - private $uploaderFactory; - - /** - * @param \Magento\Framework\File\UploaderFactory $uploaderFactory - * @param RequestDataInterface $requestData - * @param \Magento\Framework\Filesystem $filesystem - * @param \Magento\Framework\Filesystem\DirectoryList $directoryList - * @param \Magento\Framework\Model\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList - * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource - * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection - * @param array $data - */ public function __construct( - \Magento\Framework\File\UploaderFactory $uploaderFactory, - RequestDataInterface $requestData, - \Magento\Framework\Filesystem $filesystem, - \Magento\Framework\Filesystem\DirectoryList $directoryList, - \Magento\Framework\Model\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Framework\App\Config\ScopeConfigInterface $config, - \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, - \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, - \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + private UploaderFactory $uploaderFactory, + private RequestDataInterface $requestData, + private Filesystem $filesystem, + private DirectoryList $directoryList, + Context $context, + Registry $registry, + ScopeConfigInterface $config, + TypeListInterface $cacheTypeList, + ?AbstractResource $resource = null, + ?AbstractDb $resourceCollection = null, array $data = [], ) { parent::__construct( @@ -83,10 +57,6 @@ public function __construct( $resourceCollection, $data, ); - $this->requestData = $requestData; - $this->filesystem = $filesystem; - $this->uploaderFactory = $uploaderFactory; - $this->directoryList = $directoryList; } /** diff --git a/Model/Event.php b/Model/Event.php index d90da71..924004f 100644 --- a/Model/Event.php +++ b/Model/Event.php @@ -9,14 +9,17 @@ namespace Mygento\Base\Model; use Magento\Framework\Model\AbstractModel; +use Mygento\Base\Api\Data\EventInterface; -class Event extends AbstractModel implements \Mygento\Base\Api\Data\EventInterface +class Event extends AbstractModel implements EventInterface { + /** @inheritDoc */ + protected $_eventPrefix = 'mygento_base_event'; + /** * Get id - * @return int|null */ - public function getId() + public function getId(): ?int { return $this->getData(self::ID); } @@ -24,142 +27,120 @@ public function getId() /** * Set id * @param int $id - * @return $this */ - public function setId($id) + public function setId($id): self { return $this->setData(self::ID, $id); } /** * Get instance - * @return string|null */ - public function getInstance() + public function getInstance(): string { return $this->getData(self::INSTANCE); } /** * Set instance - * @param string $instance - * @return $this */ - public function setInstance($instance) + public function setInstance(string $instance): self { return $this->setData(self::INSTANCE, $instance); } /** * Get channel - * @return string|null */ - public function getChannel() + public function getChannel(): string { return $this->getData(self::CHANNEL); } /** * Set channel - * @param string $channel - * @return $this */ - public function setChannel($channel) + public function setChannel(string $channel): self { return $this->setData(self::CHANNEL, $channel); } /** * Get level - * @return int|null */ - public function getLevel() + public function getLevel(): int { return $this->getData(self::LEVEL); } /** * Set level - * @param int $level - * @return $this */ - public function setLevel($level) + public function setLevel(int $level): self { return $this->setData(self::LEVEL, $level); } /** * Get message - * @return string|null */ - public function getMessage() + public function getMessage(): string { return $this->getData(self::MESSAGE); } /** * Set message - * @param string $message - * @return $this */ - public function setMessage($message) + public function setMessage(string $message): self { return $this->setData(self::MESSAGE, $message); } /** * Get logged at - * @return string|null */ - public function getLoggedAt() + public function getLoggedAt(): string { return $this->getData(self::LOGGED_AT); } /** * Set logged at - * @param string $loggedAt - * @return $this */ - public function setLoggedAt($loggedAt) + public function setLoggedAt(string $loggedAt): self { return $this->setData(self::LOGGED_AT, $loggedAt); } /** * Get context - * @return string|null */ - public function getContext() + public function getContext(): ?string { return $this->getData(self::CONTEXT); } /** * Set context - * @param string $context - * @return $this */ - public function setContext($context) + public function setContext(?string $context): self { return $this->setData(self::CONTEXT, $context); } /** * Get extra - * @return string|null */ - public function getExtra() + public function getExtra(): ?string { return $this->getData(self::EXTRA); } /** * Set extra - * @param string $extra - * @return $this */ - public function setExtra($extra) + public function setExtra(?string $extra): self { return $this->setData(self::EXTRA, $extra); } @@ -169,6 +150,6 @@ public function setExtra($extra) */ protected function _construct() { - $this->_init(\Mygento\Base\Model\ResourceModel\Event::class); + $this->_init(ResourceModel\Event::class); } } diff --git a/Model/Event/DataProvider.php b/Model/Event/DataProvider.php index 5a3379a..178fcfe 100644 --- a/Model/Event/DataProvider.php +++ b/Model/Event/DataProvider.php @@ -9,48 +9,38 @@ namespace Mygento\Base\Model\Event; use Magento\Framework\App\Request\DataPersistorInterface; +use Magento\Ui\DataProvider\Modifier\PoolInterface; +use Magento\Ui\DataProvider\ModifierPoolDataProvider; +use Mygento\Base\Model\ResourceModel\Event\Collection; use Mygento\Base\Model\ResourceModel\Event\CollectionFactory; -class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider +class DataProvider extends ModifierPoolDataProvider { - /** @var \Mygento\Base\Model\ResourceModel\Event\Collection */ + /** @var Collection */ protected $collection; - /** @var DataPersistorInterface */ - protected $dataPersistor; + private DataPersistorInterface $dataPersistor; + private array $loadedData = []; - /** @var array */ - protected $loadedData; - - /** - * @param \Mygento\Base\Model\ResourceModel\Event\CollectionFactory $collectionFactory - * @param \Magento\Framework\App\Request\DataPersistorInterface $dataPersistor - * @param string $name - * @param string $primaryFieldName - * @param string $requestFieldName - * @param array $meta - * @param array $data - */ public function __construct( CollectionFactory $collectionFactory, DataPersistorInterface $dataPersistor, - $name, - $primaryFieldName, - $requestFieldName, + string $name, + string $primaryFieldName, + string $requestFieldName, array $meta = [], array $data = [], + ?PoolInterface $pool = null, ) { - parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data); + parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); + $this->collection = $collectionFactory->create(); $this->dataPersistor = $dataPersistor; } - /** - * @return array|null - */ - public function getData() + public function getData(): array { - if (isset($this->loadedData)) { + if (!empty($this->loadedData)) { return $this->loadedData; } $items = $this->collection->getItems(); diff --git a/Model/EventRepository.php b/Model/EventRepository.php index 5c6c8d5..8eb2508 100644 --- a/Model/EventRepository.php +++ b/Model/EventRepository.php @@ -8,56 +8,41 @@ namespace Mygento\Base\Model; -use Magento\Framework\Api\SortOrder; -use Magento\Framework\Data\Collection; +use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; +use Magento\Framework\Api\SearchCriteriaInterface; +use Magento\Framework\Exception\CouldNotDeleteException; +use Magento\Framework\Exception\CouldNotSaveException; +use Magento\Framework\Exception\NoSuchEntityException; +use Mygento\Base\Api\Data\EventInterface; +use Mygento\Base\Api\Data\EventInterfaceFactory; +use Mygento\Base\Api\Data\EventSearchResultsInterface; +use Mygento\Base\Api\Data\EventSearchResultsInterfaceFactory; +use Mygento\Base\Api\EventRepositoryInterface; +use Mygento\Base\Model\ResourceModel\Event\CollectionFactory; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class EventRepository implements \Mygento\Base\Api\EventRepositoryInterface +class EventRepository implements EventRepositoryInterface { - /** @var \Mygento\Base\Model\ResourceModel\Event */ - private $resource; - - /** @var \Mygento\Base\Model\ResourceModel\Event\CollectionFactory */ - private $collectionFactory; - - /** @var \Mygento\Base\Api\Data\EventInterfaceFactory */ - private $entityFactory; - - /** @var \Mygento\Base\Api\Data\EventSearchResultsInterfaceFactory */ - private $searchResultsFactory; - - /** - * @param \Mygento\Base\Model\ResourceModel\Event $resource - * @param \Mygento\Base\Model\ResourceModel\Event\CollectionFactory $collectionFactory - * @param \Mygento\Base\Api\Data\EventInterfaceFactory $entityFactory - * @param \Mygento\Base\Api\Data\EventSearchResultsInterfaceFactory $searchResultsFactory - */ public function __construct( - ResourceModel\Event $resource, - ResourceModel\Event\CollectionFactory $collectionFactory, - \Mygento\Base\Api\Data\EventInterfaceFactory $entityFactory, - \Mygento\Base\Api\Data\EventSearchResultsInterfaceFactory $searchResultsFactory, - ) { - $this->resource = $resource; - $this->collectionFactory = $collectionFactory; - $this->entityFactory = $entityFactory; - $this->searchResultsFactory = $searchResultsFactory; - } + private readonly ResourceModel\Event $resource, + private readonly CollectionFactory $collectionFactory, + private readonly EventInterfaceFactory $entityFactory, + private readonly EventSearchResultsInterfaceFactory $searchResultsFactory, + private readonly CollectionProcessorInterface $collectionProcessor, + ) {} /** - * @param int $entityId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @return \Mygento\Base\Api\Data\EventInterface + * @throws NoSuchEntityException */ - public function getById($entityId) + public function getById(int $entityId): EventInterface { $entity = $this->entityFactory->create(); $this->resource->load($entity, $entityId); if (!$entity->getId()) { - throw new \Magento\Framework\Exception\NoSuchEntityException( - __('Base Event with id "%1" does not exist.', $entityId), + throw new NoSuchEntityException( + __('A Base Event with id "%1" does not exist', $entityId), ); } @@ -65,19 +50,16 @@ public function getById($entityId) } /** - * @param \Mygento\Base\Api\Data\EventInterface $entity - * @psalm-param \Mygento\Base\Api\Data\EventInterface&\Magento\Framework\Model\AbstractModel $event - * @throws \Magento\Framework\Exception\CouldNotSaveException - * @return \Mygento\Base\Api\Data\EventInterface + * @throws CouldNotSaveException */ - public function save(\Mygento\Base\Api\Data\EventInterface $entity) + public function save(EventInterface $entity): EventInterface { try { - /** @psalm-param \Mygento\Base\Api\Data\EventInterface&\Magento\Framework\Model\AbstractModel $event */ $this->resource->save($entity); } catch (\Exception $exception) { - throw new \Magento\Framework\Exception\CouldNotSaveException( - __($exception->getMessage()), + throw new CouldNotSaveException( + __('Could not save the Base Event'), + $exception, ); } @@ -85,16 +67,14 @@ public function save(\Mygento\Base\Api\Data\EventInterface $entity) } /** - * @param \Mygento\Base\Api\Data\EventInterface $entity - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return bool + * @throws CouldNotDeleteException */ - public function delete(\Mygento\Base\Api\Data\EventInterface $entity) + public function delete(EventInterface $entity): bool { try { $this->resource->delete($entity); } catch (\Exception $exception) { - throw new \Magento\Framework\Exception\CouldNotDeleteException( + throw new CouldNotDeleteException( __($exception->getMessage()), ); } @@ -103,53 +83,22 @@ public function delete(\Mygento\Base\Api\Data\EventInterface $entity) } /** - * @param int $entityId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return bool + * @throws NoSuchEntityException + * @throws CouldNotDeleteException */ - public function deleteById($entityId) + public function deleteById(int $entityId): bool { return $this->delete($this->getById($entityId)); } - /** - * @param \Magento\Framework\Api\SearchCriteriaInterface $criteria - * @return \Mygento\Base\Api\Data\EventSearchResultsInterface - */ - public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria) + public function getList(SearchCriteriaInterface $criteria): EventSearchResultsInterface { /** @var \Mygento\Base\Model\ResourceModel\Event\Collection $collection */ $collection = $this->collectionFactory->create(); - foreach ($criteria->getFilterGroups() as $filterGroup) { - $fields = []; - $conditions = []; - foreach ($filterGroup->getFilters() as $filter) { - $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; - $fields[] = $filter->getField(); - $conditions[] = [$condition => $filter->getValue()]; - } - if ($fields) { - $collection->addFieldToFilter($fields, $conditions); - } - } - $sortOrders = $criteria->getSortOrders(); - $sortAsc = SortOrder::SORT_ASC; - $orderAsc = Collection::SORT_ORDER_ASC; - $orderDesc = Collection::SORT_ORDER_DESC; - if ($sortOrders) { - /** @var SortOrder $sortOrder */ - foreach ($sortOrders as $sortOrder) { - $collection->addOrder( - $sortOrder->getField(), - ($sortOrder->getDirection() == $sortAsc) ? $orderAsc : $orderDesc, - ); - } - } - $collection->setCurPage($criteria->getCurrentPage()); - $collection->setPageSize($criteria->getPageSize()); - /** @var \Mygento\Base\Api\Data\EventSearchResultsInterface $searchResults */ + $this->collectionProcessor->process($criteria, $collection); + + /** @var EventSearchResultsInterface $searchResults */ $searchResults = $this->searchResultsFactory->create(); $searchResults->setSearchCriteria($criteria); $searchResults->setItems($collection->getItems()); diff --git a/Model/EventSearchResults.php b/Model/EventSearchResults.php new file mode 100644 index 0000000..5562576 --- /dev/null +++ b/Model/EventSearchResults.php @@ -0,0 +1,14 @@ +eventRepository = $eventRepository; @@ -47,21 +31,18 @@ public function __construct( /** * Writes the record down to the log of the implementing handler - * - * @param array $record - * @return void */ - protected function write(array $record): void + protected function write(LogRecord $record): void { $event = $this->eventFactory->create(); $event->setInstance(gethostname()); - $event->setLevel($record['level']); - $event->setChannel($record['channel']); - $event->setMessage($record['message']); + $event->setLevel($record->level); + $event->setChannel($record->channel); + $event->setMessage($record->message); //serialize - $event->setContext($this->serialize($record['context'])); - $event->setExtra($this->serialize($record['extra'])); + $event->setContext($this->serialize($record->context)); + $event->setExtra($this->serialize($record->extra)); $this->eventRepository->save($event); } diff --git a/Model/Logger/Handler.php b/Model/Logger/Handler.php index 16e7e35..9869e6b 100644 --- a/Model/Logger/Handler.php +++ b/Model/Logger/Handler.php @@ -8,17 +8,14 @@ namespace Mygento\Base\Model\Logger; +use Magento\Framework\Filesystem\DriverInterface; + class Handler extends \Magento\Framework\Logger\Handler\Base { - /** - * @param string $name - * @param \Magento\Framework\Filesystem\DriverInterface $filesystem - * @param string $filePath - */ public function __construct( - $name, - \Magento\Framework\Filesystem\DriverInterface $filesystem, - $filePath = null, + string $name, + DriverInterface $filesystem, + ?string $filePath = null, ) { $this->fileName = DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR . $name . '.log'; diff --git a/Model/Logger/Logger.php b/Model/Logger/Logger.php index 053578d..d41768d 100644 --- a/Model/Logger/Logger.php +++ b/Model/Logger/Logger.php @@ -10,11 +10,8 @@ class Logger extends \Magento\Framework\Logger\Monolog { - /** - * @param string $name - */ public function __construct( - $name, + string $name, ) { parent::__construct( $name, diff --git a/Model/Mock/OrderMock.php b/Model/Mock/OrderMock.php index 24f7b31..0a72336 100644 --- a/Model/Mock/OrderMock.php +++ b/Model/Mock/OrderMock.php @@ -9,7 +9,10 @@ namespace Mygento\Base\Model\Mock; use Magento\Framework\DataObject; +use Magento\Sales\Api\Data\OrderAddressInterface; +use Magento\Sales\Api\Data\OrderExtensionInterface; use Magento\Sales\Api\Data\OrderInterface; +use Magento\Sales\Api\Data\OrderPaymentInterface; /** * Class OrderMock @@ -44,7 +47,7 @@ public function getPayment() return parent::getPayment(); } - public function setBillingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $address = null) + public function setBillingAddress(?OrderAddressInterface $address = null) { return parent::setBillingAddress($address); } @@ -59,7 +62,7 @@ public function setState($state) return parent::setState($state); } - public function setPayment(\Magento\Sales\Api\Data\OrderPaymentInterface $payment = null) + public function setPayment(?OrderPaymentInterface $payment = null) { return parent::setPayment($payment); } @@ -99,7 +102,7 @@ public function getExtensionAttributes() return parent::getExtensionAttributes(); } - public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderExtensionInterface $extensionAttributes) + public function setExtensionAttributes(OrderExtensionInterface $extensionAttributes) { return parent::setExtensionAttributes($extensionAttributes); } @@ -749,7 +752,7 @@ public function getXForwardedFor() return parent::getXForwardedFor(); } - public function setStatusHistories(array $statusHistories = null) + public function setStatusHistories(?array $statusHistories = null) { return parent::setStatusHistories($statusHistories); } diff --git a/Model/ResourceModel/Event.php b/Model/ResourceModel/Event.php index 202b004..a7b7242 100644 --- a/Model/ResourceModel/Event.php +++ b/Model/ResourceModel/Event.php @@ -8,14 +8,18 @@ namespace Mygento\Base\Model\ResourceModel; -class Event extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; + +class Event extends AbstractDb { + public const TABLE_NAME = 'mygento_base_event'; + public const TABLE_PRIMARY_KEY = 'id'; + /** * Initialize resource model - * @return void */ protected function _construct() { - $this->_init('mygento_base_event', 'id'); + $this->_init(self::TABLE_NAME, self::TABLE_PRIMARY_KEY); } } diff --git a/Model/ResourceModel/Event/Collection.php b/Model/ResourceModel/Event/Collection.php index c547478..b1f6436 100644 --- a/Model/ResourceModel/Event/Collection.php +++ b/Model/ResourceModel/Event/Collection.php @@ -8,10 +8,14 @@ namespace Mygento\Base\Model\ResourceModel\Event; -class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection +use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; +use Mygento\Base\Model\Event; +use Mygento\Base\Model\ResourceModel\Event as EventResource; + +class Collection extends AbstractCollection { /** @var string */ - protected $_idFieldName = 'id'; + protected $_idFieldName = EventResource::TABLE_PRIMARY_KEY; /** * Define resource model @@ -19,8 +23,8 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab protected function _construct() { $this->_init( - \Mygento\Base\Model\Event::class, - \Mygento\Base\Model\ResourceModel\Event::class, + Event::class, + EventResource::class, ); } } diff --git a/Model/ResourceModel/Event/Grid/Collection.php b/Model/ResourceModel/Event/Grid/Collection.php index 83b987f..44a8899 100644 --- a/Model/ResourceModel/Event/Grid/Collection.php +++ b/Model/ResourceModel/Event/Grid/Collection.php @@ -8,41 +8,36 @@ namespace Mygento\Base\Model\ResourceModel\Event\Grid; +use Magento\Framework\Api\Search\AggregationInterface; use Magento\Framework\Api\Search\SearchResultInterface; use Magento\Framework\Api\SearchCriteriaInterface; +use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; +use Magento\Framework\Data\Collection\EntityFactoryInterface; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Mygento\Base\Model\ResourceModel\Event\Collection as ParentCollection; +use Psr\Log\LoggerInterface; class Collection extends ParentCollection implements SearchResultInterface { - /** @var \Magento\Framework\Api\Search\AggregationInterface */ - protected $aggregations; + protected AggregationInterface $aggregations; /** - * @param \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory - * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param string $mainTable - * @param string $eventPrefix - * @param string $eventObject - * @param string $resourceModel - * @param string $model - * @param \Magento\Framework\DB\Adapter\AdapterInterface|string|null $connection - * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb|null $resource * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, - \Psr\Log\LoggerInterface $logger, - \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Framework\Event\ManagerInterface $eventManager, + EntityFactoryInterface $entityFactory, + LoggerInterface $logger, + FetchStrategyInterface $fetchStrategy, + ManagerInterface $eventManager, string $mainTable, string $eventPrefix, string $eventObject, string $resourceModel, string $model = \Magento\Framework\View\Element\UiComponent\DataProvider\Document::class, - \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, - \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null, + ?AdapterInterface $connection = null, + ?AbstractDb $resource = null, ) { parent::__construct( $entityFactory, @@ -90,7 +85,7 @@ public function getSearchCriteria() * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function setSearchCriteria(SearchCriteriaInterface $searchCriteria = null) + public function setSearchCriteria(?SearchCriteriaInterface $searchCriteria = null) { return $this; } @@ -118,7 +113,7 @@ public function setTotalCount($totalCount) * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function setItems(array $items = null) + public function setItems(?array $items = null) { return $this; } diff --git a/Model/Source/Loglevel.php b/Model/Source/Loglevel.php index 721a211..e66fcf9 100644 --- a/Model/Source/Loglevel.php +++ b/Model/Source/Loglevel.php @@ -8,18 +8,21 @@ namespace Mygento\Base\Model\Source; +use Monolog\Level; + class Loglevel implements \Magento\Framework\Data\OptionSourceInterface { /** * Return array of options as value-label pairs, eg. value => label * - * @return array + * @return array */ - public function toOptionArray() + public function toOptionArray(): array { $levels = []; - foreach (\Monolog\Logger::getLevels() as $level => $value) { - $levels[] = ['value' => $value, 'label' => $level]; + $list = array_combine(Level::NAMES, Level::VALUES); + foreach ($list as $level => $value) { + $levels[$value] = $level; } return $levels; diff --git a/Test/Extra/TableOutput.php b/Test/Extra/TableOutput.php index 61ec499..c0ea05c 100644 --- a/Test/Extra/TableOutput.php +++ b/Test/Extra/TableOutput.php @@ -47,7 +47,7 @@ public static function dump($headers, $rows = null) $table->render(); } - public static function dumpResult(Result $result, string $title = null) + public static function dumpResult(Result $result, ?string $title = null) { $output = new StreamOutput(fopen('php://stdout', 'w')); $table = new SymfonyTable($output); @@ -106,7 +106,7 @@ public static function dumpResult(Result $result, string $title = null) $table->render(); } - public static function dumpOrder(OrderInterface $order, string $title = null) + public static function dumpOrder(OrderInterface $order, ?string $title = null) { self::showOrderLegend(); diff --git a/Test/framework/bootstrap.php b/Test/framework/bootstrap.php index 96bc247..2c16939 100644 --- a/Test/framework/bootstrap.php +++ b/Test/framework/bootstrap.php @@ -43,7 +43,6 @@ function ($errNo, $errStr, $errFile, $errLine) { E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', - E_STRICT => 'Strict', E_RECOVERABLE_ERROR => 'Recoverable Error', E_DEPRECATED => 'Deprecated', E_USER_DEPRECATED => 'User Deprecated', diff --git a/composer.json b/composer.json index 82cff57..d02b99c 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "mygento" ], "require": { - "php": ">=8.0.0", + "php": ">=8.2.0", "ext-bcmath": "*", "magento/framework": "103.*", "magento/module-sales": "103.*", diff --git a/etc/db_schema.xml b/etc/db_schema.xml index 2cfbf07..65b41a6 100644 --- a/etc/db_schema.xml +++ b/etc/db_schema.xml @@ -1,14 +1,14 @@ - - +
+ - + - - + + diff --git a/etc/di.xml b/etc/di.xml index 8c18651..78cd733 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -1,10 +1,4 @@ - @@ -43,7 +37,7 @@ - + @@ -51,6 +45,20 @@ + + + + Magento\Framework\Api\SearchCriteria\CollectionProcessor\FilterProcessor + Magento\Framework\Api\SearchCriteria\CollectionProcessor\SortingProcessor + Magento\Framework\Api\SearchCriteria\CollectionProcessor\PaginationProcessor + + + + + + Mygento\Base\Model\SearchCriteria\EventCollectionProcessor + + diff --git a/grumphp.yml b/grumphp.yml index 57fe3d7..92b5c80 100644 --- a/grumphp.yml +++ b/grumphp.yml @@ -21,4 +21,5 @@ grumphp: phpstan: autoload_file: 'vendor/mygento/coding-standard/stan/autoload.php' ignore_patterns: ['Test'] + memory_limit: '-1' level: 1 diff --git a/view/adminhtml/ui_component/base_event_listing.xml b/view/adminhtml/ui_component/base_event_listing.xml index 2a7f33e..691762e 100644 --- a/view/adminhtml/ui_component/base_event_listing.xml +++ b/view/adminhtml/ui_component/base_event_listing.xml @@ -63,6 +63,9 @@ text text + + true + @@ -73,6 +76,9 @@ text text + + true + @@ -83,6 +89,11 @@ select select + + true + true + true + @@ -94,6 +105,9 @@ text text + + true + @@ -104,6 +118,9 @@ date date + + true +