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 = [];
- Read upRead up
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) {
- Read upRead up
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);
}
- Read upRead up
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;
/**
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) {
- Read upRead up
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 = [];
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) {
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);
}
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) {
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');
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) {
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', []);
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) {
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;
- Read upRead up
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 [];
- Read upRead up
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) {
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');
- Read upRead up
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;
- Read upRead up
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) {
- Read upRead up
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', []);
- Read upRead up
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"