Showing 71 of 85 total issues
AbstractQueryBuilder
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractQueryBuilder implements QueryBuilder
{
private ?Field $currentField = null;
private bool $queryOnFieldIsCacheable = false;
private bool $inField = false;
Method extractSymbolOrKeyword
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function extractSymbolOrKeyword(string $value): bool
{
$len = strlen($value);
if ($len > 3) {
return false;
Function extractSymbolOrKeyword
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
private function extractSymbolOrKeyword(string $value): bool
{
$len = strlen($value);
if ($len > 3) {
return 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 extractTokens
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private function extractTokens(string $value): void
{
if ('' === $value) {
if ($this->lastToken->typeEqualsAnyOf([Token::T_REQUIRED, Token::T_PROHIBITED, Token::T_IGNORED])) {
// todo: review the process of bool operators following ignored values.
- 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 AbstractQueryBuilder.php
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Gdbots\QueryParser\Builder;
File QueryParser.php
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Gdbots\QueryParser;
File ElasticaQueryBuilder.php
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Gdbots\QueryParser\Builder;
Method extractTokens
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function extractTokens(string $value): void
{
if ('' === $value) {
if ($this->lastToken->typeEqualsAnyOf([Token::T_REQUIRED, Token::T_PROHIBITED, Token::T_IGNORED])) {
// todo: review the process of bool operators following ignored values.
File Tokenizer.php
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Gdbots\QueryParser;
Function handleFieldWithRange
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function handleFieldWithRange(string $fieldName, BoolOperator $boolOperator)
{
$exclusive = $this->stream->typeIs(Token::T_RANGE_EXCL_START);
$matchTypes = true;
$this->stream->next();
- 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 handleRange
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function handleRange(Range $range, Field $field, bool $cacheable = false): void
{
$useBoost = $field->useBoost();
$boost = $field->getBoost();
$boolOp = $field->getBoolOperator();
- 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
ElasticaQueryBuilder
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class ElasticaQueryBuilder extends AbstractQueryBuilder
{
protected RuflinQueryBuilder $qb;
protected BoolQuery $boolQuery;
Method handleFieldWithRange
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleFieldWithRange(string $fieldName, BoolOperator $boolOperator)
{
$exclusive = $this->stream->typeIs(Token::T_RANGE_EXCL_START);
$matchTypes = true;
$this->stream->next();
Function addTextToQuery
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function addTextToQuery(string $method, Node $node, ?Field $field = null): void
{
if ($node instanceof Word && $node->isStopWord() && $this->ignoreStopWords) {
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 addTermToQuery
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function addTermToQuery(string $method, Node $node, ?Field $field = null, bool $cacheable = false): void
{
if ($node instanceof Emoji && $this->ignoreEmojis) {
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 handleSubquery
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function handleSubquery(BoolOperator $queryBoolOperator)
{
$this->stream->nextIf(Token::T_SUBQUERY_START);
/** @var Node[] $nodes */
$nodes = [];
- 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 addTextToQuery
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addTextToQuery(string $method, Node $node, ?Field $field = null): void
{
if ($node instanceof Word && $node->isStopWord() && $this->ignoreStopWords) {
return;
}
Method handleRange
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleRange(Range $range, Field $field, bool $cacheable = false): void
{
$useBoost = $field->useBoost();
$boost = $field->getBoost();
$boolOp = $field->getBoolOperator();
Method addTermToQuery
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addTermToQuery(string $method, Node $node, ?Field $field = null, bool $cacheable = false): void
{
if ($node instanceof Emoji && $this->ignoreEmojis) {
return;
}
Function printSimpleNode
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function printSimpleNode(string $rule, Node $node, ?Field $field = null): void
{
if ($this->inRange()) {
$this->printLine(sprintf('<%s>%s</%s>', $node::NODE_TYPE, $node->getValue(), $node::NODE_TYPE));
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"