Function search
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Open
public function search($date, $settings, $query_list, $fields, $date_field, $date_type, $result_type, $filter_range) {
// If we're looking for no results, set filter to (< 1)
if($result_type == self::R_NO_RESULTS) {
$filter_range = [0, 0];
}
- 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 search
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function search($date, $settings, $query_list, $fields, $date_field, $date_type, $result_type, $filter_range) {
// If we're looking for no results, set filter to (< 1)
if($result_type == self::R_NO_RESULTS) {
$filter_range = [0, 0];
}
Method constructQuery
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function constructQuery() {
$query = Util::get($this->obj['query_data'], 'query');
$fields = Util::get($this->obj['query_data'], 'fields', []);
$parser = new \ESQuery\Parser;
list($settings, $query_list) = $parser->parse($query);
Method search
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function search($date, $settings, $query_list, $fields, $date_field, $date_type, $result_type, $filter_range) {
Function isWorking
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function isWorking($date) {
$cfg = $this->getConfig();
$client = ESClient::getClient($this->getClientConfigKey());
$working = false;
- 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 constructQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function constructQuery() {
$query = Util::get($this->obj['query_data'], 'query');
$fields = Util::get($this->obj['query_data'], 'fields', []);
$parser = new \ESQuery\Parser;
list($settings, $query_list) = $parser->parse($query);
- 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"