Showing 228 of 247 total issues

Field has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class Field implements Expressionable
{
    use DiContainerTrait {
        setDefaults as private _setDefaults;
    }
Severity: Minor
Found in src/Field.php - About 2 hrs to fix

Function _subrenderCondition has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    #[\Override]
    protected function _subrenderCondition(array $row): string
    {
        if (count($row) !== 1) {
            [$field, $operator, $value] = $row;
Severity: Minor
Found in src/Persistence/Sql/Oracle/Query.php - About 2 hrs to fix

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 evaluateIf has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function evaluateIf($v1, string $operator, $v2): bool
    {
        if ($v2 instanceof self) {
            $v2 = $v2->getRows();
        }
Severity: Minor
Found in src/Persistence/Array_/Action.php - About 2 hrs to fix

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 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _execute(?object $connection, bool $fromExecuteStatement)
    {
        if ($connection === null) {
            $connection = $this->connection;
        }
Severity: Major
Found in src/Persistence/Sql/Expression.php - About 2 hrs to fix

Connection has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Connection
{
    use DiContainerTrait;

    /** @var class-string<Expression> */
Severity: Minor
Found in src/Persistence/Sql/Connection.php - About 2 hrs to fix

Reference has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Reference
{
    use DiContainerTrait;
    use InitializerTrait {
        init as private _init;
Severity: Minor
Found in src/Reference.php - About 2 hrs to fix

Method normalizeDsn has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function normalizeDsn($dsn, $user = null, $password = null)
    {
        // BC for 2.4 - 3.0 accepted DSN input
        if (is_string($dsn)) {
            $dsn = ['dsn' => $dsn];
Severity: Major
Found in src/Persistence/Sql/Connection.php - About 2 hrs to fix

Function createIteratorBy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function createIteratorBy($field, $operator = null, $value = null): \Traversable
    {
        $this->assertIsModel();

        $scopeOrig = null;
Severity: Minor
Found in src/Model.php - About 2 hrs to fix

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 match has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function match(array $row, Model\Scope\AbstractScope $condition): bool
    {
        if ($condition instanceof Model\Scope\Condition) { // simple condition
            $args = $condition->toQueryArguments();

Severity: Minor
Found in src/Persistence/Array_/Action.php - About 2 hrs to fix

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 fixMssqlOracleMissingFieldsInGroup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function fixMssqlOracleMissingFieldsInGroup(Model $model, Query $query): void
    {
        if ($this->getDatabasePlatform() instanceof SQLServerPlatform
                || $this->getDatabasePlatform() instanceof OraclePlatform) {
            $isIdFieldInGroup = false;
Severity: Minor
Found in src/Persistence/Sql.php - About 2 hrs to fix

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 escapeStringLiteral has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    #[\Override]
    protected function escapeStringLiteral(string $value): string
    {
        $dummyPersistence = (new \ReflectionClass(Persistence\Sql::class))->newInstanceWithoutConstructor();
        if (\Closure::bind(static fn () => $dummyPersistence->explicitCastIsEncodedBinary($value), null, Persistence\Sql::class)()) {
Severity: Minor
Found in src/Persistence/Sql/Mssql/ExpressionTrait.php - About 2 hrs to fix

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

File Connection.php has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Atk4\Data\Persistence\Sql;
Severity: Minor
Found in src/Persistence/Sql/Connection.php - About 2 hrs to fix

Array_ has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Array_ extends Persistence
{
    /** @var array<string, array<int|string, mixed>> */
    private array $seedData;

Severity: Minor
Found in src/Persistence/Array_.php - About 2 hrs to fix

Method evaluateIf has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function evaluateIf($v1, string $operator, $v2): bool
    {
        if ($v2 instanceof self) {
            $v2 = $v2->getRows();
        }
Severity: Major
Found in src/Persistence/Array_/Action.php - About 2 hrs to fix

Method listSequences has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function listSequences(): array
    {
        if (version_compare(Connection::getDriverVersion(), '3.37') < 0) {
            $listAllSchemasSql = (new Query())
                ->table('pragma_database_list')

Persistence has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Persistence
{
    use ContainerTrait {
        add as private _add;
    }
Severity: Minor
Found in src/Persistence.php - About 2 hrs to fix

Method _renderConditionLikeOperator has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    #[\Override]
    protected function _renderConditionLikeOperator(bool $negated, string $sqlLeft, string $sqlRight): string
    {
        return ($negated ? 'not ' : '') . $this->_renderConditionBinaryReuseBool(
            $sqlLeft,
Severity: Major
Found in src/Persistence/Sql/Mssql/Query.php - About 2 hrs to fix

Method toQueryArguments has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function toQueryArguments(): array
    {
        $field = $this->field;
        $operator = $this->operator;
        $value = $this->value;
Severity: Major
Found in src/Model/Scope/Condition.php - About 2 hrs to fix

Method valueToWords has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function valueToWords(Model $model, $value): string
    {
        if ($value === null) {
            return $this->operator
                ? 'empty'
Severity: Major
Found in src/Model/Scope/Condition.php - About 2 hrs to fix

Method compareExportUnorderedValue has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function compareExportUnorderedValue($a, $b): int
    {
        if ($a === $b) {
            return 0;
        }
Severity: Major
Found in src/Schema/TestCase.php - About 2 hrs to fix
Severity
Category
Status
Source
Language