Mirocow/yii2-elasticsearch

View on GitHub
src/components/queries/helpers/QueryHelper.php

Summary

Maintainability
C
7 hrs
Test Coverage

QueryHelper has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class QueryHelper
{
    /**
     * @example QueryHelper::bool(QueryHelper::match(), QueryHelper::match(), QueryHelper::match(), QueryHelper::match())
     * @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/query-filter-context.html
Severity: Minor
Found in src/components/queries/helpers/QueryHelper.php - About 3 hrs to fix

    File QueryHelper.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace mirocow\elasticsearch\components\queries\helpers;
    
    use yii\helpers\ArrayHelper;
    
    
    Severity: Minor
    Found in src/components/queries/helpers/QueryHelper.php - About 2 hrs to fix

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

          private static function buildOrderBy($columns) :array
          {
              $orders = [];
              foreach ($columns as $name => $direction) {
                  if (is_string($direction)) {
      Severity: Minor
      Found in src/components/queries/helpers/QueryHelper.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

      There are no issues that match your filters.

      Category
      Status