Skip to content

Commit

Permalink
Remove redundant method
Browse files Browse the repository at this point in the history
  • Loading branch information
Usik2203 committed Jun 9, 2020
1 parent b3d318d commit 9104cb5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;

use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
use Magento\CatalogImportExport\Model\Import\Product\StoreResolver;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractPrice;
use Magento\Customer\Api\GroupRepositoryInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;

class TierPrice extends \Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractPrice
class TierPrice extends AbstractPrice
{
/**
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver
* @var StoreResolver
*/
protected $storeResolver;

Expand All @@ -27,14 +34,14 @@ class TierPrice extends \Magento\CatalogImportExport\Model\Import\Product\Valida
];

/**
* @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
* @param \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
* @param GroupRepositoryInterface $groupRepository
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param StoreResolver $storeResolver
*/
public function __construct(
\Magento\Customer\Api\GroupRepositoryInterface $groupRepository,
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
GroupRepositoryInterface $groupRepository,
SearchCriteriaBuilder $searchCriteriaBuilder,
StoreResolver $storeResolver
) {
$this->storeResolver = $storeResolver;
parent::__construct($groupRepository, $searchCriteriaBuilder);
Expand All @@ -53,6 +60,7 @@ public function init($context)

/**
* @param string $attribute
*
* @return void
*/
protected function addDecimalError($attribute)
Expand Down Expand Up @@ -83,12 +91,12 @@ public function getCustomerGroups()
}

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* Validation
*
* @param mixed $value
* @return bool
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
public function isValid($value)
{
Expand Down Expand Up @@ -133,6 +141,7 @@ public function isValid($value)
* Check if at list one value and length are valid
*
* @param array $value
*
* @return bool
*/
protected function isValidValueAndLength(array $value)
Expand All @@ -150,6 +159,7 @@ protected function isValidValueAndLength(array $value)
* Check if value has empty columns
*
* @param array $value
*
* @return bool
*/
protected function hasEmptyColumns(array $value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,24 @@
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;

use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;

/**
* Class TierPriceType validates tier price type.
*/
class TierPriceType extends \Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator
class TierPriceType extends AbstractImportValidator
{
/**
* {@inheritdoc}
*/
public function init($context)
{
return parent::init($context);
}

/**
* Validate tier price type.
*
* @param array $value
*
* @return bool
*/
public function isValid($value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,47 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;

use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface;
use Magento\CatalogImportExport\Model\Import\Product\StoreResolver;
use Magento\CatalogImportExport\Model\Import\Product\Validator\AbstractImportValidator;
use Magento\Store\Model\Website as WebsiteModel;

class Website extends AbstractImportValidator implements RowValidatorInterface
{
/**
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver
* @var StoreResolver
*/
protected $storeResolver;

/**
* @var \Magento\Store\Model\Website
* @var WebsiteModel
*/
protected $websiteModel;

/**
* @param \Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver
* @param \Magento\Store\Model\Website $websiteModel
* @param StoreResolver $storeResolver
* @param WebsiteModel $websiteModel
*/
public function __construct(
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver,
\Magento\Store\Model\Website $websiteModel
StoreResolver $storeResolver,
WebsiteModel $websiteModel
) {
$this->storeResolver = $storeResolver;
$this->websiteModel = $websiteModel;
}

/**
* {@inheritdoc}
*/
public function init($context)
{
return parent::init($context);
}

/**
* Validate by website type
*
* @param array $value
* @param string $websiteCode
*
* @return bool
*/
protected function isWebsiteValid($value, $websiteCode)
Expand All @@ -63,6 +61,7 @@ protected function isWebsiteValid($value, $websiteCode)
* Validate value
*
* @param mixed $value
*
* @return bool
*/
public function isValid($value)
Expand All @@ -85,6 +84,7 @@ public function isValid($value)
*/
public function getAllWebsitesValue()
{
return AdvancedPricing::VALUE_ALL_WEBSITES . ' ['.$this->websiteModel->getBaseCurrency()->getCurrencyCode().']';
return AdvancedPricing::VALUE_ALL_WEBSITES .
' [' . $this->websiteModel->getBaseCurrency()->getCurrencyCode() . ']';
}
}

0 comments on commit 9104cb5

Please sign in to comment.