Showing 34 of 34 total issues
Method prepareModels
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepareModels()
{
if (!$this->query instanceof QueryBuilder) {
throw new InvalidConfigException('The "query" property must be an instance of a class \mirocow\elasticsearch\components\queries\QueryBuilder or its subclasses.');
Method populate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function populate()
{
$rows = &$this->result;
if ($this->indexBy === null) {
Method generateQuery
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateQuery()
{
$fields = [
Method createIndex
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function createIndex($className, $indexConfig = [])
{
if(!class_exists($className)){
throw new SearchQueryException("Index class not found");
}
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)) {
- 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 prepareModels
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function prepareModels()
{
if (!$this->query instanceof QueryBuilder) {
throw new InvalidConfigException('The "query" property must be an instance of a class \mirocow\elasticsearch\components\queries\QueryBuilder or its subclasses.');
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(string $requestQuery, string $message = null, $code = 0, $filename = __FILE__, $lineno = __LINE__, \Exception $previous = null)
Function generateQuery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function generateQuery($nestedAggs = [])
{
if (empty($nestedAggs)) {
$nestedAggs = $this->nestedAggs;
if ($this->nestedAggMulti !== 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 dateHistogram
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function dateHistogram($field, $dateHistogramOptions = [], $nestedAgg = null, $aggName = '', $keyAsString = true)
Method range
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function range($field, $ranges, $rangeOptions = [], $nestedAgg = null, $aggName = '')
Method filter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function filter($field, $query, $nestedAgg = null, $aggName = '', $filterKey = '')
Function result
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function result()
{
if($this->result instanceof SearchResponseIterator){
return new SearchHitIterator($this->result);
} else {
- 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 index
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function index($document)
{
foreach ($this->indexes as $index) {
if (!$index->accepts($document)) {
continue;
- 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 generateQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function generateQuery()
{
$fields = [
- 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"