rhopress/yii2-rhopress

View on GitHub
models/Article.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\rhopress\Module' in method 'attributeLabels'.
Open

            'update_time' => Module::t('models', 'Last Updated At'),
Severity: Minor
Found in models/Article.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 '\rhopress\Module' in method 'attributeLabels'.
Open

            'create_time' => Module::t('models', 'Created At'),
Severity: Minor
Found in models/Article.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 'rhopress\models\Comment' in method 'createComment'.
Open

        $model = Comment::buildNoInitModel();
Severity: Minor
Found in models/Article.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' in method 'createComment'.
Open

        return Yii::createObject($config);
Severity: Minor
Found in models/Article.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 'rhopress\models\ArticleQuery' in method 'init'.
Open

        $this->queryClass = ArticleQuery::className();
Severity: Minor
Found in models/Article.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 '\rhopress\Module' in method 'attributeLabels'.
Open

            'content' => Module::t('models', 'Content'),
Severity: Minor
Found in models/Article.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 'rhopress\models\Comment' in method 'createComment'.
Open

            $config['class'] = Comment::className();
Severity: Minor
Found in models/Article.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 '\rhopress\Module' in method 't'.
Open

        return Module::t('models/article', $message, $params, $language);
Severity: Minor
Found in models/Article.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\Inflector' in method 'generateNewSlugName'.
Open

            $name = Inflector::slug($title);
Severity: Minor
Found in models/Article.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 'rhopress\models\Comment' in method 'getComments'.
Open

        return $this->hasMany(Comment::className(), ['article_guid' => $this->guidAttribute])->inverseOf('article');
Severity: Minor
Found in models/Article.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 short method names like Article::t(). The configured minimum method name length is 3.
Open

    public static function t($message, $params = [], $language = null)
    {
        return Module::t('models/article', $message, $params, $language);
    }
Severity: Minor
Found in models/Article.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Whitespace found at end of line
Open

     * 
Severity: Minor
Found in models/Article.php by phpcodesniffer

Opening brace should be on a new line
Open

    public static function find() {
Severity: Minor
Found in models/Article.php by phpcodesniffer

There are no issues that match your filters.

Category
Status