rhosocial/yii2-organization

View on GitHub
grid/OrganizationListActionColumn.php

Summary

Maintainability
B
6 hrs
Test Coverage

Method initVisibleButtons has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function initVisibleButtons()
    {
        if (!empty($this->visibleButtons)) {
            return;
        }
Severity: Minor
Found in grid/OrganizationListActionColumn.php - About 1 hr to fix

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

        protected function initDefaultButtons()
        {
            $this->initDefaultButton('view', false);
            $this->initDefaultButton('member', false, [
                'title' => Yii::t('organization', 'Member'),
    Severity: Minor
    Found in grid/OrganizationListActionColumn.php - About 1 hr to fix

      Function initUrlCreator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function initUrlCreator()
          {
              if (isset($this->urlCreator)) {
                  return;
              }
      Severity: Minor
      Found in grid/OrganizationListActionColumn.php - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid too many return statements within this method.
      Open

                      return Url::to(['update', 'id' => $model->getID()]);
      Severity: Major
      Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return Yii::$app->authManager->checkAccess($this->operator->getGUID(), $permission, ['organization' => $model]);
        Severity: Major
        Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return false;
          Severity: Major
          Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return Url::to(['exit', 'id' => $model->getID()]);
            Severity: Major
            Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return true;
              Severity: Major
              Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return Url::to(['revoke', 'id' => $model->getID()]);
                Severity: Major
                Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return '#';
                  Severity: Major
                  Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return Url::to(['settings', 'id' => $model->getID()]);
                    Severity: Major
                    Found in grid/OrganizationListActionColumn.php - About 30 mins to fix

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

                                  'aria-label' => Yii::t('organization', 'Settings'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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\Url' in method 'initUrlCreator'.
                      Open

                                      return Url::to(['view', 'id' => $model->getID()]);
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'aria-label' => Yii::t('organization', 'Member'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'aria-label' => Yii::t('organization', 'Set Up New Department'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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\Url' in method 'initUrlCreator'.
                      Open

                                      return Url::to(['exit', 'id' => $model->getID()]);
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'aria-label' => Yii::t('organization', 'Remove'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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\Url' in method 'initUrlCreator'.
                      Open

                                      return Url::to(['settings', 'id' => $model->getID()]);
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'title' => Yii::t('organization', 'Set Up New Department'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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\Url' in method 'initUrlCreator'.
                      Open

                                      return Url::to(['update', 'id' => $model->getID()]);
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'title' => Yii::t('organization', 'Settings'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'title' => Yii::t('organization', 'Exit'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'title' => Yii::t('organization', 'Member'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'data-confirm' => Yii::t('organization', 'Are you sure you want to revoke this organization / department?'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'aria-label' => Yii::t('organization', 'Exit'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'init'.
                      Open

                                  $this->header = Yii::t('user', 'Action');
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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\Url' in method 'initUrlCreator'.
                      Open

                                      return Url::to(['set-up-department', 'parent' => $model->getID()]);
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'title' => Yii::t('organization', 'Remove'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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\Url' in method 'initUrlCreator'.
                      Open

                                      return Url::to(['revoke', 'id' => $model->getID()]);
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 'initDefaultButtons'.
                      Open

                                  'data-confirm' => Yii::t('organization', 'Are you sure you want to withdraw from this organization / department?'),
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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\Url' in method 'initUrlCreator'.
                      Open

                                      return Url::to(['member', 'org' => $model->getID()]);
                      Severity: Minor
                      Found in grid/OrganizationListActionColumn.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 128 characters
                      Open

                                      return Yii::$app->authManager->checkAccess($this->operator->getGUID(), $permission, ['organization' => $model]);

                      Line exceeds 120 characters; contains 121 characters
                      Open

                                      $permission = ($model->isOrganization()) ? (new RevokeOrganization)->name : (new RevokeDepartment)->name;

                      Line exceeds 120 characters; contains 144 characters
                      Open

                                      return Yii::$app->authManager->checkAccess($this->operator->getGUID(), (new SetUpDepartment)->name, ['organization' => $model]);

                      Line exceeds 120 characters; contains 142 characters
                      Open

                                      return Yii::$app->authManager->checkAccess($this->operator->getGUID(), (new ManageProfile)->name, ['organization' => $model]);

                      Line exceeds 120 characters; contains 142 characters
                      Open

                                      return Yii::$app->authManager->checkAccess($this->operator->getGUID(), (new ManageProfile)->name, ['organization' => $model]);

                      Line exceeds 120 characters; contains 127 characters
                      Open

                                  'data-confirm' => Yii::t('organization', 'Are you sure you want to withdraw from this organization / department?'),

                      There are no issues that match your filters.

                      Category
                      Status