Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-virtual-category/Plugin/Catalog/Helper/BreadcrumbPlugin.php

Summary

Maintainability
B
4 hrs
Test Coverage

Showing 7 of 7 total issues

Function getSubtreeBreadcrumbPath has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

private function getSubtreeBreadcrumbPath($helper, $appliedRoot)
{
if (!$this->categoryPath) {
$path = [];
$category = $helper->getCategory();

Avoid too many return statements within this method.
Open

return false;

    Assigning array<string>|array{product:array{label:mixed}}|array{}</string> to property but \Smile\ElasticsuiteVirtualCategory\Plugin\Catalog\Helper\BreadcrumbPlugin->categoryPath is null
    Open

    $this->categoryPath = $path;

    Returning type null but getSubtreeBreadcrumbPath() is declared to return array
    Open

    return $this->categoryPath;

    Argument 1 (appliedRoot) is \Magento\Catalog\Model\Category but \Smile\ElasticsuiteVirtualCategory\Model\VirtualCategory\Root::getSubtreePathIds() takes \Magento\Catalog\Api\Data\CategoryInterface defined at /code/src/module-elasticsuite-virtual-category/Model/VirtualCategory/Root.php:159
    Open

    $categoryIds = $this->virtualCategoryRoot->getSubtreePathIds($appliedRoot, $category);

    Argument 1 (appliedRootCategory) is \Magento\Catalog\Model\Category|null but \Smile\ElasticsuiteVirtualCategory\Model\Url::getVirtualCategorySubtreeUrl() takes \Magento\Catalog\Api\Data\CategoryInterface defined at /code/src/module-elasticsuite-virtual-category/Model/Url.php:200
    Open

    $this->virtualCategoryRoot->getAppliedRootCategory(),

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    private function getCategoriesByIds($categoryIds)
    {
    $collection = $this->categoryCollectionFactory->create();
     
    $collection->addIsActiveFilter()
    src/module-elasticsuite-virtual-category/Model/VirtualCategory/Root.php on lines 228..240
    Category
    Status