rhopress/yii2-rhopress

View on GitHub
models/RegisterForm.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\Yii' in method 'rules'.
Open

            ['confirm_password', 'compare', 'compareAttribute' => 'password', 'message' => Yii::t('app', ('The confirm password should be consistent with password.'))],
Severity: Minor
Found in models/RegisterForm.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\Profile' in method 'register'.
Open

        $profile = $user->create(Profile::className(), ['nickname' => $this->username, 'display_name' => $this->username]);
Severity: Minor
Found in models/RegisterForm.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\Email' in method 'register'.
Open

        $email = $user->create(Email::className(), ['email' => $this->email]);
Severity: Minor
Found in models/RegisterForm.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

The property $confirm_password is not named in camelCase.
Open

class RegisterForm extends \yii\base\Model
{

    public $username;
    public $email;
Severity: Minor
Found in models/RegisterForm.php by phpmd

CamelCasePropertyName

Since: 0.2

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

Example

class ClassName {
    protected $property_name;
}

Source

Line exceeds 120 characters; contains 168 characters
Open

            ['confirm_password', 'compare', 'compareAttribute' => 'password', 'message' => Yii::t('app', ('The confirm password should be consistent with password.'))],
Severity: Minor
Found in models/RegisterForm.php by phpcodesniffer

Line exceeds 120 characters; contains 123 characters
Open

        $profile = $user->create(Profile::className(), ['nickname' => $this->username, 'display_name' => $this->username]);
Severity: Minor
Found in models/RegisterForm.php by phpcodesniffer

There are no issues that match your filters.

Category
Status