File Expression.php
has 512 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Atk4\Data\Persistence\Sql;
- Create a ticketCreate a ticket
Function _execute
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
protected function _execute(?object $connection, bool $fromExecuteStatement)
{
if ($connection === null) {
$connection = $this->connection;
}
- Read upRead up
- Create a ticketCreate a ticket
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 32 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Expression implements Expressionable, \ArrayAccess
{
use DiContainerTrait;
private static ?SqlFormatter $debugFormatter = null;
- Create a ticketCreate a ticket
Method _execute
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _execute(?object $connection, bool $fromExecuteStatement)
{
if ($connection === null) {
$connection = $this->connection;
}
- Create a ticketCreate a ticket
Method getDebugQuery
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDebugQuery(): string
{
[$sql, $params] = $this->render();
$i = 0;
- Create a ticketCreate a ticket
Method _render
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _render(): array
{
// - [xxx] = param
// - {xxx} = escape
// - {{xxx}} = escapeSoft
- Create a ticketCreate a ticket
Method consume
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function consume($expr, string $escapeMode): string
{
if (!is_object($expr)) {
switch ($escapeMode) {
case self::ESCAPE_PARAM:
- Create a ticketCreate a ticket
Function castGetValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function castGetValue($v): ?string
{
if (is_bool($v)) {
return $v ? '1' : '0';
} elseif (is_int($v)) {
- Read upRead up
- Create a ticketCreate a ticket
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 consume
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function consume($expr, string $escapeMode): string
{
if (!is_object($expr)) {
switch ($escapeMode) {
case self::ESCAPE_PARAM:
- Read upRead up
- Create a ticketCreate a ticket
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 $this->escapeStringLiteral($v);
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $matches[0];
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $sql;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return (string) $v;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return self::castFloatToString($v);
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return '*long string* (length: ' . strlen($v) . ' bytes, sha256: ' . hash('sha256', $v) . ')';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $sql;
- Create a ticketCreate a ticket