Showing 229 of 251 total issues

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

Function action has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function action(Model $model, string $type, array $args = [])
    {
        switch ($type) {
            case 'select':
                $query = $this->initQuery($model);
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 join has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function join(
        $foreignTable,
        $masterField = null,
        $joinKind = null,
        $foreignAlias = null
Severity: Minor
Found in src/Persistence/Sql/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

Method addKeyOwner has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addKeyOwner(object $owner, int $hash, int $index): void
    {
        if (!$this->ownerDestructorHandlers->offsetExists($owner)) {
            $this->ownerDestructorHandlers->offsetSet($owner, new class($this, $this->destructedEarly) {
                /** @var \WeakReference<WeakAnalysingMap<TKey, TValue, TOwner>> */
Severity: Major
Found in src/Reference/WeakAnalysingMap.php - About 2 hrs to fix

Method getDebugQuery has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getDebugQuery(): string
    {
        [$sql, $params] = $this->render();

        $i = 0;
Severity: Major
Found in src/Persistence/Sql/Expression.php - About 2 hrs to fix

Method _typecastPreField has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function _typecastPreField(Field $field, $value, bool $fromLoad)
    {
        if (is_string($value)) {
            switch ($field->type) {
                case 'boolean':
Severity: Minor
Found in src/Persistence.php - About 2 hrs to fix

Method updateRenderBeforeExecute has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    #[\Override]
    protected function updateRenderBeforeExecute(array $render): array
    {
        [$sql, $params] = parent::updateRenderBeforeExecute($render);

Severity: Minor
Found in src/Persistence/Sql/Oracle/ExpressionTrait.php - About 1 hr to fix

Function escapeStringLiteral has a Cognitive Complexity of 15 (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->binaryTypeValueIsEncoded($value), null, Persistence\Sql::class)()) {
Severity: Minor
Found in src/Persistence/Sql/Postgresql/ExpressionTrait.php - About 1 hr 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 where has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function where($field, $operator = null, $value = null, $kind = 'where', $numArgs = null)
    {
        // number of passed arguments will be used to determine if arguments were specified or not
        if ($numArgs === null) {
            $numArgs = 'func_num_args'();
Severity: Minor
Found in src/Persistence/Sql/Query.php - About 1 hr 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 setOrder has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function setOrder($field, string $direction = 'asc')
    {
        $this->assertIsModel();

        // fields passed as array
Severity: Minor
Found in src/Model.php - About 1 hr 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 _subrenderCondition has a Cognitive Complexity of 15 (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 1 hr 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 createAnalysingTheirModel has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function createAnalysingTheirModel(array $defaults = []): Model
    {
        if ((self::$analysingTheirModelMap ?? null) === null) {
            self::$analysingTheirModelMap = new WeakAnalysingMap();
        }
Severity: Minor
Found in src/Reference.php - About 1 hr 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 setModel has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function setModel(Model $model): Model
    {
        $this->table($model->table);

        foreach ($model->getFields() as $field) {
Severity: Minor
Found in src/Schema/Migrator.php - About 1 hr 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 drop has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function drop(bool $dropForeignKeysFirst = false): self
    {
        $schemaManager = $this->createSchemaManager();

        if ($dropForeignKeysFirst) {
Severity: Minor
Found in src/Schema/Migrator.php - About 1 hr 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 deduplicateAnalysingKey has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function deduplicateAnalysingKey(array $analysingKey, object $analysingOwner): array
    {
        if ((self::$analysingClosureMap ?? null) === null) {
            self::$analysingClosureMap = new WeakAnalysingMap();
        }
Severity: Minor
Found in src/Reference.php - About 1 hr 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 export has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function export(?array $fields = null, ?string $keyField = null, bool $typecast = true): array
    {
        $this->assertHasPersistence('export');

        // no key field - then just do export
Severity: Minor
Found in src/Model.php - About 1 hr to fix

Method createIteratorBy has 45 lines of code (exceeds 25 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 1 hr to fix

Method addField has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addField(string $fieldName, array $defaults = []): Field
    {
        if (!isset($defaults['aggregate']) && !isset($defaults['concat']) && !isset($defaults['expr'])) {
            throw (new Exception('Aggregate field requires "aggregate", "concat" or "expr" specified to hasMany()->addField()'))
                ->addMoreInfo('field', $fieldName)
Severity: Minor
Found in src/Reference/HasMany.php - About 1 hr to fix

Function splitLongString has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function splitLongString(string $value, int $lengthBytes): array
    {
        $res = [];
        $value = array_reverse(str_split($value, 2 * $lengthBytes));
        $i = count($value) - 1;
Severity: Minor
Found in src/Persistence/Sql/Oracle/ExpressionTrait.php - About 1 hr 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

Severity
Category
Status
Source
Language