Showing 43 of 49 total issues
File Query.php
has 711 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Atk4\Dsql;
Method connectDbalConnection
has 219 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function connectDbalConnection(array $dsn)
{
if (isset($dsn['pdo'])) {
$pdo = $dsn['pdo'];
} else {
Query
has 53 functions (exceeds 20 allowed). Consider refactoring. Open
class Query extends Expression
{
/**
* Query will use one of the predefined templates. The $mode will contain
* name of template used. Basically it's part of Query property name -
File Connection.php
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Atk4\Dsql;
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
Function _sub_render_condition
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
protected function _sub_render_condition(array $row): string
{
if (count($row) === 3) {
[$field, $cond, $value] = $row;
} elseif (count($row) === 2) {
- 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 join
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function join(
$foreign_table,
$master_field = null,
$join_kind = null,
$_foreign_alias = 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
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 */
Function connectDbalConnection
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected static function connectDbalConnection(array $dsn)
{
// for some reasons, the following error:
// PDOException: SQLSTATE[HY000]: pdo_oci_handle_factory: ORA-12516: TNS:listener could not find available handler with matching protocol stack
// is shown randomly when a lot of connections are created in tests,
- 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 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;
Method where
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function where($field, $cond = null, $value = null, $kind = 'where', $num_args = null)
{
// Number of passed arguments will be used to determine if arguments were specified or not
if ($num_args === null) {
$num_args = func_num_args();
Method _sub_render_condition
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _sub_render_condition(array $row): string
{
if (count($row) === 3) {
[$field, $cond, $value] = $row;
} elseif (count($row) === 2) {
Function where
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function where($field, $cond = null, $value = null, $kind = 'where', $num_args = null)
{
// Number of passed arguments will be used to determine if arguments were specified or not
if ($num_args === null) {
$num_args = func_num_args();
- 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 join
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function join(
$foreign_table,
$master_field = null,
$join_kind = null,
$_foreign_alias = null
Function _render_case
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function _render_case(): ?string
{
if (!isset($this->args['case_when'])) {
return 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 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
Function order
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function order($order, $desc = null)
{
// Case with comma-separated fields or first argument being an array
if (is_string($order) && strpos($order, ',') !== false) {
$order = explode(',', $order);
- 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 table
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function table($table, $alias = null)
{
// comma-separated table names
if (is_string($table) && strpos($table, ',') !== false) {
$table = explode(',', $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"