Showing 83 of 111 total issues
ExportEntity
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class ExportEntity
{
/**
* @var Store
*/
Method getStockItemMap
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStockItemMap(Collection|StockCollection $collection): array
{
if ($collection->count() === 0) {
return [];
}
File EavIterator.php
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
ExportEntity
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class ExportEntity
{
/**
* @var Store
*/
ExportEntity
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class ExportEntity
{
/**
* @var Store
*/
Method execute
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
return $this->state->emulateAreaCode(
Area::AREA_CRONTAB,
function () use ($input, $output) {
Function exportStore
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function exportStore(Writer $writer, XMLWriter $xml, Store $store, array $entityIds = []): void
{
// Set root category as exported
$exportedCategories = [1 => true];
$storeId = $store->getId();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function loopUnionRows
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function loopUnionRows(MysqlStatement $stmt)
{
$entity = ['entity_id' => null];
while ($row = $stmt->fetch()) {
$attributeId = $row['attribute_id'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
EavIterator
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class EavIterator implements IteratorAggregate
{
/**
* @var int
*/
Method generateToFile
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateToFile($feedFile, $validate, $store = null, $type = null): void
{
$this->executeLocked(
function () use ($feedFile, $validate, $store, $type) {
$tmpFeedFile = $this->config->getFeedTmpFile($feedFile, $store);
Function decorate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function decorate(Collection|StockCollection $collection): void
{
foreach ($collection as $exportEntity) {
if (!$exportEntity instanceof CompositeExportEntityInterface) {
continue;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getStockItem
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getStockItem(): ?StockItem
{
if ($this->isStockCombined) {
return $this->stockItem;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createChildEntities
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function createChildEntities(Collection|StockCollection|PriceCollection $collection): void
{
foreach ($this->getCompositeEntities($collection) as $typeId => $group) {
// Create fake product type to trick type factory to use getTypeId
/** @var Product $fakeProduct */
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getStockItem
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStockItem(): ?StockItem
{
if ($this->isStockCombined) {
return $this->stockItem;
}
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
ProductRepositoryInterface $productRepository,
ProductInterfaceFactory $productFactory,
StockRegistryInterface $stockRegistry,
CategoryLinkManagementInterface $categoryLinkManagement,
EntityHydrator $hydrator,
Method addBundleChildren
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addBundleChildren(Collection|StockCollection|PriceCollection $collection, array $parentIds): void
{
$connection = $this->dbResource->getConnection();
$select = $connection->select();
Function shouldExportByChildStatus
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function shouldExportByChildStatus(): bool
{
$optionGroupStatus = [];
foreach ($this->getAllChildren() as $child) {
$childOptions = $child->getChildOptions();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method normalizeAttributeValue
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function normalizeAttributeValue(int $storeId, string $attributeCode, $value): array
{
$values = $this->ensureArray($value);
$values = array_map(
function ($value) {
Method exportStore
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exportStore(Writer $writer, XMLWriter $xml, Store $store, array $entityIds = []): void
{
// Set root category as exported
$exportedCategories = [1 => true];
$storeId = $store->getId();
Method loopUnionRows
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function loopUnionRows(MysqlStatement $stmt)
{
$entity = ['entity_id' => null];
while ($row = $stmt->fetch()) {
$attributeId = $row['attribute_id'];