su-xiaolin/notify

View on GitHub
src/Notifier.php

Summary

Maintainability
A
0 mins
Test Coverage

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

    public function options($array = false)
Severity: Minor
Found in src/Notifier.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' in method 'instance'.
Open

            $_instance = Yii::createObject(static::className());
Severity: Minor
Found in src/Notifier.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\helpers\ArrayHelper' in method 'option'.
Open

        return ArrayHelper::getValue($this->options(true), $key, $default);
Severity: Minor
Found in src/Notifier.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

Opening brace should be on a new line
Open

    public static function instance() {
Severity: Minor
Found in src/Notifier.php by phpcodesniffer

Expected 1 space after FOREACH keyword; 0 found
Open

        foreach($flash as $key => $value) {
Severity: Minor
Found in src/Notifier.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in src/Notifier.php by phpcodesniffer

The variable $_instance is not named in camelCase.
Open

    public static function instance() {
        static $_instance;
        if (!isset($_instance)) {
            $_instance = Yii::createObject(static::className());
        }
Severity: Minor
Found in src/Notifier.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_instance is not named in camelCase.
Open

    public static function instance() {
        static $_instance;
        if (!isset($_instance)) {
            $_instance = Yii::createObject(static::className());
        }
Severity: Minor
Found in src/Notifier.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $_instance is not named in camelCase.
Open

    public static function instance() {
        static $_instance;
        if (!isset($_instance)) {
            $_instance = Yii::createObject(static::className());
        }
Severity: Minor
Found in src/Notifier.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status