File DBConvertStructuredQueryToSQL.php
has 405 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Squirrel\Queries\Doctrine;
use Squirrel\Debug\Debug;
Consider simplifying this complex logical expression. Open
if (
\str_contains($expression, ' ')
|| \str_contains($expression, '=')
|| \str_contains($expression, '<')
|| \str_contains($expression, '>')
Function buildChanges
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function buildChanges(array $changes, array $queryValues): array
{
// List of finished change expressions, to be imploded with ,
$changesList = [];
- 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 verifyAndProcessOptions
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verifyAndProcessOptions(array $validOptions, array $options): array
{
// Convert "table" to "tables"
if (
isset($options['table'])
Function verifyAndProcessOptions
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function verifyAndProcessOptions(array $validOptions, array $options): array
{
// Convert "table" to "tables"
if (
isset($options['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
Function buildWhere
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function buildWhere(array $whereOptions, array $queryValues = []): array
{
// If no WHERE restrictions are defined, we just do "WHERE 1"
if (\count($whereOptions) === 0) {
return ['1', $queryValues];
- 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 buildFieldSelection
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function buildFieldSelection(array $fields): string
{
// No fields mean we select all fields!
if (\count($fields) === 0) {
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
Method buildChanges
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildChanges(array $changes, array $queryValues): array
{
// List of finished change expressions, to be imploded with ,
$changesList = [];
Function buildOrderBy
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function buildOrderBy(array $orderOptions): string
{
// List of finished WHERE expressions, to be imploded with ANDs
$orderProcessed = [];
- 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 buildWhere
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildWhere(array $whereOptions, array $queryValues = []): array
{
// If no WHERE restrictions are defined, we just do "WHERE 1"
if (\count($whereOptions) === 0) {
return ['1', $queryValues];
Method buildFieldSelection
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildFieldSelection(array $fields): string
{
// No fields mean we select all fields!
if (\count($fields) === 0) {
return '*';
Method buildGroupBy
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildGroupBy(array $groupByOptions): string
{
// List of finished WHERE expressions, to be imploded with ANDs
$groupByProcessed = [];
Method buildOrderBy
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildOrderBy(array $orderOptions): string
{
// List of finished WHERE expressions, to be imploded with ANDs
$orderProcessed = [];
Function buildGroupBy
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function buildGroupBy(array $groupByOptions): string
{
// List of finished WHERE expressions, to be imploded with ANDs
$groupByProcessed = [];
- 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 buildTableJoins
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function buildTableJoins(array $tables): array
{
// List of query values for PDO
$queryValues = [];
- 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 buildTableJoins
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildTableJoins(array $tables): array
{
// List of query values for PDO
$queryValues = [];
Consider simplifying this complex logical expression. Open
if (
\str_contains($expression, ' ')
|| \str_contains($expression, '=')
|| \str_contains($expression, '<')
|| \str_contains($expression, '>')
Function addQueryVariablesNoNull
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function addQueryVariablesNoNull(array $existingValues, mixed $newValues): array
{
// Convert to array of values if not already done
if (!\is_array($newValues)) {
$newValues = [$newValues];
- 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"