LAV45/yii2-settings

View on GitHub
src/Model.php

Summary

Maintainability
A
0 mins
Test Coverage

The method getSaveAttributes has a boolean flag argument $safeOnly, which is a certain sign of a Single Responsibility Principle violation.
Open

    protected function getSaveAttributes($safeOnly = false)
Severity: Minor
Found in src/Model.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method getSaveAttributeList has a boolean flag argument $safeOnly, which is a certain sign of a Single Responsibility Principle violation.
Open

    protected function getSaveAttributeList($safeOnly = false)
Severity: Minor
Found in src/Model.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method save has a boolean flag argument $runValidation, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function save($runValidation = true)
Severity: Minor
Found in src/Model.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'setData'.
Open

        return $this->getSettings()->set($this->getSettingsKey(), ArrayHelper::toArray($data));
Severity: Minor
Found in src/Model.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\yii\di\Instance' in method 'getSettings'.
Open

            $this->settings = Instance::ensure($this->settings, Settings::class);
Severity: Minor
Found in src/Model.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

There are no issues that match your filters.

Category
Status