Showing 30 of 44 total issues
File CommonGrammar.php
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Finesse\QueryScribe\Grammars;
use Finesse\QueryScribe\Exceptions\InvalidQueryException;
CommonGrammar
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class CommonGrammar implements GrammarInterface
{
use CommonGrammarCriteriaTrait;
use CommonGrammarOrderTrait;
Method whereArgumentsToCriterion
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function whereArgumentsToCriterion(
array $arguments,
string $appendRule = 'AND',
bool $valueIsColumn = false
): Criterion {
Function compileInsertFromValues
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function compileInsertFromValues($table, string $tableAlias = null, array $values): array
{
if (empty($values)) {
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 processQuery
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function processQuery(Query $query, $context): Query
{
$queryProperties = [];
// Table
- 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 processQuery
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processQuery(Query $query, $context): Query
{
$queryProperties = [];
// Table
Function whereArgumentsToCriterion
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function whereArgumentsToCriterion(
array $arguments,
string $appendRule = 'AND',
bool $valueIsColumn = false
): Criterion {
- 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 compileCriteria
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function compileCriteria(array $criteria, array &$bindings): string
{
$criteriaSQL = '';
$previousAppendRule = 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 compileInsert
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compileInsert(Query $query): array
{
if ($query->table === null) {
throw new InvalidQueryException('The INTO table is not set');
}
Method compileInsertFromValues
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function compileInsertFromValues($table, string $tableAlias = null, array $values): array
{
if (empty($values)) {
return [];
}
Function addInsert
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function addInsert(array $rows): self
{
if (!empty($rows) && !is_array(reset($rows))) {
$rows = [$rows];
}
- 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 addInsert
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addInsert(array $rows): self
{
if (!empty($rows) && !is_array(reset($rows))) {
$rows = [$rows];
}
Function addInsertFromSelect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addInsertFromSelect($columns, $selectQuery = null): self
{
if ($selectQuery === null) {
$selectQuery = $columns;
$columns = 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
Function addSelect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function addSelect($columns, string $alias = null): self
{
if (!is_array($columns)) {
if ($alias === null) {
$columns = [$columns];
- 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 compileCriterion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function compileCriterion(Criterion $criterion, array &$bindings): string
{
if ($criterion instanceof ValueCriterion) {
return $this->compileValueCriterion($criterion, $bindings);
}
- 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 compileInsert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function compileInsert(Query $query): array
{
if ($query->table === null) {
throw new InvalidQueryException('The INTO table is not set');
}
- 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 whereBetween
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function whereBetween($column, $min, $max, bool $not = false, string $appendRule = 'AND'): self
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($column, $min, $max, bool $not, string $appendRule)
Function processCriterion
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function processCriterion(Criterion $criterion, $context): Criterion
{
if ($criterion instanceof ValueCriterion) {
return $this->processValueCriterion($criterion, $context);
}
- 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 processInCriterion
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function processInCriterion(InCriterion $criterion, $context): InCriterion
{
$column = $this->processColumnOrSubQuery($criterion->column, $context);
if (is_array($criterion->values)) {
$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"