File EavIterator.php
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Tweakwise (https://www.tweakwise.com/) - All Rights Reserved
*
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 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'];
Method getIterator
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getIterator(): \Traversable
{
while ($entityIds = $this->getEntityBatch()) {
try {
Profiler::start('eav-iterator::' . $this->entityCode);
Method getAttributeSelectEnterprise
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getAttributeSelectEnterprise(string $table, array $attributes): Select
{
$connection = $this->getConnection();
$select = $connection->select()
->from(['attribute_table' => $table], [])
Method __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Helper $helper,
EavConfig $eavConfig,
DbContext $dbContext,
Manager $eventManager,
string $entityCode,
Function getAttributeSelects
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function getAttributeSelects(): array
{
$selects = [];
$attributeGroups = $this->getAttributeGroups();
- 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 getIterator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getIterator(): \Traversable
{
while ($entityIds = $this->getEntityBatch()) {
try {
Profiler::start('eav-iterator::' . $this->entityCode);
- 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"