Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-swatches/Helper/Swatches.php

Summary

Maintainability
A
3 hrs
Test Coverage

Showing 3 of 3 total issues

Function loadVariationByFallback has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

public function loadVariationByFallback(Product $parentProduct, array $attributes)
{
$variation = false;
 
if ($this->isProductHasSwatch($parentProduct) && $parentProduct->getDocumentSource() !== null) {
Severity: Minor
Found in src/module-elasticsuite-swatches/Helper/Swatches.php - About 1 hr to fix

Function loadVariationsFromSearchIndex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

private function loadVariationsFromSearchIndex(Product $parentProduct, array $attributes)
{
$documentSource = $parentProduct->getDocumentSource();
$childrenIds = isset($documentSource['children_ids']) ? $documentSource['children_ids'] : [];
$variation = false;
Severity: Minor
Found in src/module-elasticsuite-swatches/Helper/Swatches.php - About 55 mins to fix

Function getOptionIds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

public function getOptionIds(Attribute $attribute, $labels)
{
$optionIds = [];
 
if (!is_array($labels)) {
Severity: Minor
Found in src/module-elasticsuite-swatches/Helper/Swatches.php - About 35 mins to fix

There are no issues that match your filters.

Category
Status