Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-tracker/Model/Event/Mapping/Update/OrderItemDate.php

Summary

Maintainability
C
1 day
Test Coverage

Showing 10 of 10 total issues

File OrderItemDate.php has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer versions in the future.

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

    public function checkIndices()
    {
    $indicesToFix = ['add' => [], 'fix' => []];
     
    foreach ($this->storeManager->getStores() as $store) {

    Method fixFieldTypeInIndices has 62 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

    public function fixFieldTypeInIndices($indices = [])
    {
    foreach ($indices as $indexData) {
    $indexName = $indexData['index'];
    $storeId = $indexData['store'];

      Method updateOrderItemDate has 57 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

      public function updateOrderItemDate()
      {
      foreach ($this->storeManager->getStores() as $store) {
      $storeId = $store->getId();
      $eventIndexAlias = $this->indexManager->getIndexAlias(EventIndexInterface::INDEX_IDENTIFIER, $storeId);

        Method checkIndices has 47 lines of code (exceeds 40 allowed). Consider refactoring.
        Open

        public function checkIndices()
        {
        $indicesToFix = ['add' => [], 'fix' => []];
         
        foreach ($this->storeManager->getStores() as $store) {

          Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          FieldInterfaceFactory $fieldFactory,
          IndexManager $indexManager,
          IndexSettingsInterface $indexSettings,
          IndexInterfaceFactory $indexFactory,
          IndexOperationInterface $indexOperation,

            Function fixFieldTypeInIndices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            public function fixFieldTypeInIndices($indices = [])
            {
            foreach ($indices as $indexData) {
            $indexName = $indexData['index'];
            $storeId = $indexData['store'];

            syntax error, unexpected ')'
            Open

            ),

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

            if (!empty($indicesToFix['add'])) {
            $this->logger->info(
            sprintf(
            '[%s] Field page.order.items.date needs to be added to the mapping of those indices: %s',
            __CLASS__,
            src/module-elasticsuite-tracker/Model/Event/Mapping/Update/OrderItemDate.php on lines 166..174

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

            if (!empty($indicesToFix['fix'])) {
            $this->logger->info(
            sprintf(
            '[%s] Field page.order.items.date exists but needs to have its type changed in indices: %s',
            __CLASS__,
            src/module-elasticsuite-tracker/Model/Event/Mapping/Update/OrderItemDate.php on lines 156..164

            There are no issues that match your filters.

            Category
            Status