File Expression.php
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Atk4\Dsql;
Function execute
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function execute(object $connection = null): object
{
if ($connection === null) {
$connection = $this->connection;
}
- 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
Expression
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Expression implements Expressionable, \ArrayAccess
{
/** @const string "[]" in template, escape as parameter */
protected const ESCAPE_PARAM = 'param';
/** @const string "{}" in template, escape as identifier */
Method execute
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute(object $connection = null): object
{
if ($connection === null) {
$connection = $this->connection;
}
Method render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render(): string
{
$hadUnderscoreParamBase = $this->_paramBase !== null;
if (!$hadUnderscoreParamBase) {
$hadUnderscoreParamBase = false;
Function getDebugQuery
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getDebugQuery(): string
{
$result = $this->render();
foreach (array_reverse($this->params) as $key => $val) {
- 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 consume
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function consume($expression, string $escapeMode = self::ESCAPE_PARAM)
{
if (!is_object($expression)) {
switch ($escapeMode) {
case self::ESCAPE_PARAM:
Function __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($properties = [], $arguments = null)
{
// save template
if (is_string($properties)) {
$properties = ['template' => $properties];
- 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
Avoid too many return
statements within this method. Open
return $ret;
Function consume
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function consume($expression, string $escapeMode = self::ESCAPE_PARAM)
{
if (!is_object($expression)) {
switch ($escapeMode) {
case self::ESCAPE_PARAM:
- 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"