Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-tracker/Block/Variables/Page/Catalog.php

Summary

Maintainability
A
1 hr
Test Coverage

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

    private function getLayerVariables()
    {
        $variables = [];
        $layer     = $this->catalogLayer;

Severity: Minor
Found in src/module-elasticsuite-tracker/Block/Variables/Page/Catalog.php - About 55 mins to fix

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 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        Template\Context $context,
        \Magento\Framework\Json\Helper\Data $jsonHelper,
        \Smile\ElasticsuiteTracker\Helper\Data $trackerHelper,
        \Magento\Framework\Registry $registry,
        \Magento\Catalog\Model\Layer\Resolver $layerResolver,
Severity: Major
Found in src/module-elasticsuite-tracker/Block/Variables/Page/Catalog.php - About 50 mins to fix

    Possibly zero references to use statement for classlike/namespace Category (\Magento\Catalog\Model\Category)
    Open

    use Magento\Catalog\Model\Category;

    Possibly zero references to use statement for classlike/namespace Navigation (\Smile\ElasticsuiteCatalog\Block\Navigation)
    Open

    use Smile\ElasticsuiteCatalog\Block\Navigation;

    Returning type null but getProductListBlock() is declared to return \Magento\Framework\View\Element\BlockInterface
    Open

            return is_object($productListBlock) ? $productListBlock : null;

    Argument 1 (categoryId) is string but \Smile\ElasticsuiteTracker\Block\Variables\Page\Catalog::getCategoryNameById() takes int defined at /code/src/module-elasticsuite-tracker/Block/Variables/Page/Catalog.php:233
    Open

                $breadcrumb[] = html_entity_decode($this->getCategoryNameById($categoryId, $category->getStoreId()));

    There are no issues that match your filters.

    Category
    Status