Function saveAndReplaceThesaurus
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
private function saveAndReplaceThesaurus(): void
{
$behavior = $this->getBehavior();
$rows = [];
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
- 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 saveThesaurusFinish
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function saveThesaurusFinish(array $thesaurusData): bool
{
foreach ($thesaurusData as $thesaurusRows) {
foreach ($thesaurusRows as $row) {
$model = $this->importProvider->createThesaurus();
- 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
Thesaurus
has 11 functions (exceeds 10 allowed). Consider refactoring. Open
class Thesaurus extends AbstractEntity
{
const ENTITY_CODE = 'thesaurus';
const COL_TERMS = 'terms_relations';
const COL_STORES = 'stores';
Function deleteThesaurus
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function deleteThesaurus(): bool
{
$rows = [];
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
foreach ($bunch as $rowNum => $rowData) {
- 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 deleteThesaurusFinish
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function deleteThesaurusFinish(array $thesaurusIds): bool
{
if ($thesaurusIds) {
try {
foreach ($thesaurusIds as $thesaurusId) {
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
JsonHelper $jsonHelper,
ImportHelper $importExportData,
Data $importData,
Helper $resourceHelper,
ProcessingErrorAggregatorInterface $errorAggregator,
Avoid too many return
statements within this method. Open
return false;
Function validateRow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function validateRow(array $rowData, $rowNum): bool
{
$name = $rowData[ThesaurusInterface::NAME] ?? '';
$type = $rowData[ThesaurusInterface::TYPE] ?? '';
$terms = $rowData[self::COL_TERMS] ?? '';
- 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
Invalid offset "type"
of array type array{}
Open
$type = $columnValues[ThesaurusInterface::TYPE];
- Exclude checks
Argument 2 (type)
is null
but \Smile\ElasticsuiteThesaurus\Model\Import\Provider::processTermsData()
takes string
defined at /code/src/module-elasticsuite-thesaurus/Model/Import/Provider.php:123
Open
$row[$columnKey] = $this->importProvider->processTermsData($row[$columnKey], $type);
- Exclude checks