File CriteriaQueryTranslation.php
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Honeybee\Infrastructure\DataAccess\Finder\Elasticsearch;
use Assert\Assertion;
Function translateFilters
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function translateFilters(CriteriaList $filter_criteria_list)
{
$elasticsearch_filters = [];
foreach ($filter_criteria_list as $criteria) {
if ($criteria instanceof CriteriaContainerInterface) {
- 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 buildSpatialFilterFor
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildSpatialFilterFor(CriteriaInterface $criteria)
{
$attribute_path = $criteria->getAttributePath();
$comparison = $criteria->getComparison();
$geometry = $comparison->getComparand();
Function translateQueries
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function translateQueries(CriteriaList $criteria_list)
{
if ($criteria_list->isEmpty()) {
return [ 'match_all' => [] ];
} 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
Method translateFilters
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function translateFilters(CriteriaList $filter_criteria_list)
{
$elasticsearch_filters = [];
foreach ($filter_criteria_list as $criteria) {
if ($criteria instanceof CriteriaContainerInterface) {
Method translateQueries
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function translateQueries(CriteriaList $criteria_list)
{
if ($criteria_list->isEmpty()) {
return [ 'match_all' => [] ];
} else {
Function buildSpatialFilterFor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function buildSpatialFilterFor(CriteriaInterface $criteria)
{
$attribute_path = $criteria->getAttributePath();
$comparison = $criteria->getComparison();
$geometry = $comparison->getComparand();
- 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 buildFilterFor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function buildFilterFor(CriteriaInterface $criteria)
{
$negate_filter = false;
$attribute_value = $criteria->getComparison()->getComparand();
$attribute_path = $criteria->getAttributePath();
- 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"