Showing 21 of 190 total issues

Function process has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(\ECL\SymbolTable $table) {
        $result = $table[\ECL\SymbolTable::DEFAULT_SYMBOL];
        $ret = [];

        $key_cache = [];
Severity: Minor
Found in src/Command/Map.php - About 3 hrs 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

Function process has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(\ECL\SymbolTable $table) {
        $result = $table[\ECL\SymbolTable::DEFAULT_SYMBOL];
        $source = $table->resolve(new \ECL\Symbol($this->source), \ECL\Symbol::T_RES);
        // Convert a left join into a right join.
        if($this->type == self::T_LEFT) {
Severity: Minor
Found in src/Command/Join.php - About 3 hrs 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

Function resolveFilter has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    private function resolveFilter(\ECL\SymbolTable $table, $node) {
        if(is_array($node)) {
            foreach($node as $k=>$entry) {
                $node[$k] = $this->resolveFilter($table, $entry);
            }
Severity: Minor
Found in src/Command/Elasticsearch.php - About 3 hrs 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

File Elasticsearch.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace ECL\Command;

/**
Severity: Minor
Found in src/Command/Elasticsearch.php - About 2 hrs to fix

    Function resolve has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resolve($sym, $type=Symbol::T_NULL) {
            $val = $sym;
            if($sym instanceof \ECL\Symbol) {
               $val = $this->offsetGet($sym->getName());
               if($type == Symbol::T_NULL) {
    Severity: Minor
    Found in src/SymbolTable.php - About 2 hrs 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 process has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function process(\ECL\SymbolTable $table) {
            $result = $table[\ECL\SymbolTable::DEFAULT_SYMBOL];
            $ret = [];
    
            $key_cache = [];
    Severity: Minor
    Found in src/Command/Map.php - About 1 hr to fix

      Method process has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function process(\ECL\SymbolTable $table) {
              $result = $table[\ECL\SymbolTable::DEFAULT_SYMBOL];
              $source = $table->resolve(new \ECL\Symbol($this->source), \ECL\Symbol::T_RES);
              // Convert a left join into a right join.
              if($this->type == self::T_LEFT) {
      Severity: Minor
      Found in src/Command/Join.php - About 1 hr to fix

        Method resolveFilter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function resolveFilter(\ECL\SymbolTable $table, $node) {
                if(is_array($node)) {
                    foreach($node as $k=>$entry) {
                        $node[$k] = $this->resolveFilter($table, $entry);
                    }
        Severity: Minor
        Found in src/Command/Elasticsearch.php - About 1 hr to fix

          Method resolve has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function resolve($sym, $type=Symbol::T_NULL) {
                  $val = $sym;
                  if($sym instanceof \ECL\Symbol) {
                     $val = $this->offsetGet($sym->getName());
                     if($type == Symbol::T_NULL) {
          Severity: Minor
          Found in src/SymbolTable.php - About 1 hr to fix

            Method constructQuery has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function constructQuery(\ECL\SymbolTable $table, array $filters, \ECL\Command\Elasticsearch\Agg $agg=null, array $settings=[]) {
                    foreach($settings as $key=>$val) {
                        $settings[$key] = $table->resolve($val);
                    }
                    $from = \ECL\Util::get($settings, 'from');
            Severity: Minor
            Found in src/Command/Elasticsearch.php - About 1 hr to fix

              Method generateDateIndices has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function generateDateIndices($format, $interval, $from_ts, $to_ts) {
                      $fmt_arr = [];
                      $escaped = false;
              
                      foreach(str_split($format) as $chr) {
              Severity: Minor
              Found in src/Util.php - About 1 hr to fix

                Method setSettings has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function setSettings(array $settings) {
                        $this->settings = $settings;
                
                        $hosts = \ECL\Util::get($settings, 'hosts', []);
                        $index_hosts = \ECL\Util::get($settings, 'index_hosts', []);
                Severity: Minor
                Found in src/Command/Elasticsearch.php - About 1 hr to fix

                  Method constructQueryBody has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private function constructQueryBody(\ECL\SymbolTable $table, array $filters, \ECL\Command\Elasticsearch\Agg $agg=null, $fields=null, $sort=null, $size=null, $date_field=null, $from=null, $to=null) {
                  Severity: Major
                  Found in src/Command/Elasticsearch.php - About 1 hr to fix

                    Function pluck has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function pluck($arr, $path) {
                            $ret = [];
                            $path = (array) $path;
                            foreach($arr as $v) {
                                $node = &$v;
                    Severity: Minor
                    Found in src/Util.php - About 1 hr 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

                    Function processResults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function processResults(\ECL\SymbolTable $table, array $results) {
                            $key = $table->resolve($this->key, \ECL\Symbol::T_STR);
                            $query_key = '$_' . $key;
                            if(!array_key_exists($query_key, $results)) {
                                return [];
                    Severity: Minor
                    Found in src/Command/Elasticsearch/Agg/Bucket.php - About 45 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 constructFilter has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        private function constructFilter(\ECL\SymbolTable $table, $filters, $date_field, $from, $to) {
                    Severity: Minor
                    Found in src/Command/Elasticsearch.php - About 35 mins to fix

                      Function constructQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function constructQuery(\ECL\SymbolTable $table, array $filters, \ECL\Command\Elasticsearch\Agg $agg=null, array $settings=[]) {
                              foreach($settings as $key=>$val) {
                                  $settings[$key] = $table->resolve($val);
                              }
                              $from = \ECL\Util::get($settings, 'from');
                      Severity: Minor
                      Found in src/Command/Elasticsearch.php - About 35 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

                      Function processHitResults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function processHitResults(&$results, $result_set, $query_settings) {
                              // If we're only returning hits, we can return the count here.
                              if($query_settings['count']) {
                                  $results[] = ['count' => array_sum(array_map(function($x) { return $x['hits']['total']; }, $result_set))];
                                  return;
                      Severity: Minor
                      Found in src/Command/Elasticsearch.php - About 35 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

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

                          public static function generateDateIndices($format, $interval, $from_ts, $to_ts) {
                              $fmt_arr = [];
                              $escaped = false;
                      
                              foreach(str_split($format) as $chr) {
                      Severity: Minor
                      Found in src/Util.php - About 25 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

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

                          public function setSettings(array $settings) {
                              $this->settings = $settings;
                      
                              $hosts = \ECL\Util::get($settings, 'hosts', []);
                              $index_hosts = \ECL\Util::get($settings, 'index_hosts', []);
                      Severity: Minor
                      Found in src/Command/Elasticsearch.php - About 25 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

                      Severity
                      Category
                      Status
                      Source
                      Language