rhosocial/yii2-organization

View on GitHub
OrganizationLimit.php

Summary

Maintainability
A
0 mins
Test Coverage

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

            $this->createdAtAttribute => Yii::t('user', 'Creation Time'),
Severity: Minor
Found in OrganizationLimit.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 'attributeLabels'.
Open

            $this->ipTypeAttribute => Yii::t('user', 'IP Address Type'),
Severity: Minor
Found in OrganizationLimit.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 assigning values to variables in if clauses and the like (line '90', column '69').
Open

    public static function getLimit($user)
    {
        if (!($user instanceof User) || ($user->getIsNewRecord() && $user = $user->getGUID())) {
            $noInit = static::buildNoInitModel();
            $class = $noInit->hostClass;
Severity: Minor
Found in OrganizationLimit.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

            $this->createdByAttribute => Yii::t('user', 'User GUID'),
Severity: Minor
Found in OrganizationLimit.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 'attributeLabels'.
Open

            $this->updatedAtAttribute => Yii::t('user', 'Last Updated Time'),
Severity: Minor
Found in OrganizationLimit.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 'attributeLabels'.
Open

            $this->guidAttribute => Yii::t('user', 'GUID'),
Severity: Minor
Found in OrganizationLimit.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 assigning values to variables in if clauses and the like (line '116', column '69').
Open

    public static function setLimit($user, $limit = 1)
    {
        if (!($user instanceof User) || ($user->getIsNewRecord() && $user = $user->getGUID())) {
            $noInit = static::buildNoInitModel();
            $class = $noInit->hostClass;
Severity: Minor
Found in OrganizationLimit.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

            $this->ipAttribute => Yii::t('user', 'IP Address'),
Severity: Minor
Found in OrganizationLimit.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 'attributeLabels'.
Open

            $this->contentAttribute => Yii::t('organization', 'Limit'),
Severity: Minor
Found in OrganizationLimit.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

Line exceeds 120 characters; contains 124 characters
Open

            [$this->contentAttribute, 'default', 'value' => is_numeric($this->defaultLimit) ? (int)$this->defaultLimit : 10]
Severity: Minor
Found in OrganizationLimit.php by phpcodesniffer

There are no issues that match your filters.

Category
Status