Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-indices/Model/IndexStatsProvider.php

Summary

Maintainability
B
5 hrs
Test Coverage

Showing 12 of 12 total issues

IndexStatsProvider has 11 functions (exceeds 10 allowed). Consider refactoring.
Open

class IndexStatsProvider
{
/**
* Cache Key Prefix.
*/
Severity: Minor
Found in src/module-elasticsuite-indices/Model/IndexStatsProvider.php - About 2 hrs to fix

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

    CacheHelper $cacheHelper,
    ClientInterface $client,
    IndicesList $indicesList,
    IndexStatusProvider $indexStatusProvider,
    LoggerInterface $logger
    Severity: Minor
    Found in src/module-elasticsuite-indices/Model/IndexStatsProvider.php - About 35 mins to fix

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

      public function getElasticSuiteIndices($params = []): array
      {
      if ($this->elasticsuiteIndices === null) {
      $this->elasticsuiteIndices = [];
       
       
      Severity: Minor
      Found in src/module-elasticsuite-indices/Model/IndexStatsProvider.php - About 25 mins to fix

      Assigning array{} to property but \Smile\ElasticsuiteIndices\Model\IndexStatsProvider->elasticsuiteIndices is null
      Open

      $this->elasticsuiteIndices = [];

      Argument 1 (array_arg) is null but \ksort() takes array
      Open

      ksort($this->elasticsuiteIndices, SORT_STRING | SORT_NATURAL);

      Assigning array<string>|array<string></string></string> to property but \Smile\ElasticsuiteIndices\Model\IndexStatsProvider->indicesStats is null
      Open

      $this->indicesStats[$indexName] = current($indexStatsResponse['indices']);

      Suspicious array access to null
      Open

      $this->elasticsuiteIndices[$name] = $aliases ? key($aliases['aliases']) : null;

      Suspicious array access to null
      Open

      $this->indicesStats[$indexName] = current($indexStatsResponse['indices']);

      Assigning false[]|int[]|null[]|string[] to property but \Smile\ElasticsuiteIndices\Model\IndexStatsProvider->elasticsuiteIndices is null
      Open

      $this->elasticsuiteIndices[$name] = $aliases ? key($aliases['aliases']) : null;

      Assigning array{} to property but \Smile\ElasticsuiteIndices\Model\IndexStatsProvider->indicesStats is null
      Open

      $this->indicesStats = [];

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

      public function getShardsConfiguration($indexName)
      {
      // Retrieve the index settings.
      $indexSettings = $this->getIndexSettings($indexName);
       
       
      src/module-elasticsuite-indices/Model/IndexStatsProvider.php on lines 253..265

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

      public function getReplicasConfiguration($indexName)
      {
      // Retrieve the index settings.
      $indexSettings = $this->getIndexSettings($indexName);
       
       
      src/module-elasticsuite-indices/Model/IndexStatsProvider.php on lines 232..244

      There are no issues that match your filters.

      Category
      Status