rhosocial/yii2-organization

View on GitHub
web/organization/controllers/my/MemberAction.php

Summary

Maintainability
A
1 hr
Test Coverage

Method run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run($org)
    {
        $organization = Module::getOrganization($org);
        $user = Yii::$app->user->identity;
        static::checkAccess($organization, $user);
Severity: Minor
Found in web/organization/controllers/my/MemberAction.php - About 1 hr to fix

    Avoid using static access to class '\rhosocial\organization\web\organization\Module' in method 'run'.
    Open

            $organization = Module::getOrganization($org);

    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 121 characters
    Open

         * The organization is null or new record, it will be considered as invalid. If so, the OrganizationNotFoundException

    There are no issues that match your filters.

    Category
    Status