rhosocial/yii2-organization

View on GitHub
Organization.php

Summary

Maintainability
F
3 days
Test Coverage

File Organization.php has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 *  _   __ __ _____ _____ ___  ____  _____
 * | | / // // ___//_  _//   ||  __||_   _|
Severity: Major
Found in Organization.php - About 1 day to fix

    Organization has 60 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Organization extends User
    {
        use SelfBlameableTrait;
    
        const TYPE_ORGANIZATION = 1;
    Severity: Major
    Found in Organization.php - About 1 day to fix

      The class Organization has an overall complexity of 153 which is very high. The configured complexity threshold is 50.
      Open

      class Organization extends User
      {
          use SelfBlameableTrait;
      
          const TYPE_ORGANIZATION = 1;
      Severity: Minor
      Found in Organization.php by phpmd

      The class Organization has 16 public methods. Consider refactoring Organization to keep number of public methods under 10.
      Open

      class Organization extends User
      {
          use SelfBlameableTrait;
      
          const TYPE_ORGANIZATION = 1;
      Severity: Minor
      Found in Organization.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      Function addMember has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addMember(&$member)
          {
              if ($this->getIsNewRecord()) {
                  return false;
              }
      Severity: Minor
      Found in Organization.php - About 2 hrs 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

      Method addMember has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function addMember(&$member)
          {
              if ($this->getIsNewRecord()) {
                  return false;
              }
      Severity: Minor
      Found in Organization.php - About 1 hr to fix

        The class Organization has 20 fields. Consider redesigning Organization to keep the number of fields under 15.
        Open

        class Organization extends User
        {
            use SelfBlameableTrait;
        
            const TYPE_ORGANIZATION = 1;
        Severity: Minor
        Found in Organization.php by phpmd

        TooManyFields

        Since: 0.1

        Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

        Example

        class Person {
           protected $one;
           private $two;
           private $three;
           [... many more fields ...]
        }

        Source https://phpmd.org/rules/codesize.html#toomanyfields

        The class Organization has 74 public methods and attributes. Consider reducing the number of public items to less than 45.
        Open

        class Organization extends User
        {
            use SelfBlameableTrait;
        
            const TYPE_ORGANIZATION = 1;
        Severity: Minor
        Found in Organization.php by phpmd

        ExcessivePublicCount

        Since: 0.1

        A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

        Example

        public class Foo {
            public $value;
            public $something;
            public $var;
            // [... more more public attributes ...]
        
            public function doWork() {}
            public function doMoreWork() {}
            public function doWorkAgain() {}
            // [... more more public methods ...]
        }

        Source https://phpmd.org/rules/codesize.html#excessivepubliccount

        Avoid too many return statements within this method.
        Open

                return $result;
        Severity: Major
        Found in Organization.php - About 30 mins to fix

          Function removeAdministrator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function removeAdministrator(&$member, $keep = true)
              {
                  if ($this->getIsNewRecord()) {
                      return false;
                  }
          Severity: Minor
          Found in Organization.php - About 25 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

          Function setSetting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function setSetting($item, $value, $unique = false)
              {
                  if (empty($this->organizationSettingClass) || !is_string($this->organizationSettingClass)) {
                      return null;
                  }
          Severity: Minor
          Found in Organization.php - About 25 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

          The class Organization has 1036 lines of code. Current threshold is 1000. Avoid really long classes.
          Open

          class Organization extends User
          {
              use SelfBlameableTrait;
          
              const TYPE_ORGANIZATION = 1;
          Severity: Minor
          Found in Organization.php by phpmd

          The method addMember() has an NPath complexity of 288000. The configured NPath complexity threshold is 200.
          Open

              public function addMember(&$member)
              {
                  if ($this->getIsNewRecord()) {
                      return false;
                  }
          Severity: Minor
          Found in Organization.php by phpmd

          NPathComplexity

          Since: 0.1

          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

          Example

          class Foo {
              function bar() {
                  // lots of complicated code
              }
          }

          Source https://phpmd.org/rules/codesize.html#npathcomplexity

          The method addMember() has a Cyclomatic Complexity of 26. The configured cyclomatic complexity threshold is 10.
          Open

              public function addMember(&$member)
              {
                  if ($this->getIsNewRecord()) {
                      return false;
                  }
          Severity: Minor
          Found in Organization.php by phpmd

          CyclomaticComplexity

          Since: 0.1

          Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

          Example

          // Cyclomatic Complexity = 11
          class Foo {
          1   public function example() {
          2       if ($a == $b) {
          3           if ($a1 == $b1) {
                          fiddle();
          4           } elseif ($a2 == $b2) {
                          fiddle();
                      } else {
                          fiddle();
                      }
          5       } elseif ($c == $d) {
          6           while ($c == $d) {
                          fiddle();
                      }
          7        } elseif ($e == $f) {
          8           for ($n = 0; $n < $h; $n++) {
                          fiddle();
                      }
                  } else {
                      switch ($z) {
          9               case 1:
                              fiddle();
                              break;
          10              case 2:
                              fiddle();
                              break;
          11              case 3:
                              fiddle();
                              break;
                          default:
                              fiddle();
                              break;
                      }
                  }
              }
          }

          Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

          The class Organization has a coupling between objects value of 26. Consider to reduce the number of dependencies under 13.
          Open

          class Organization extends User
          {
              use SelfBlameableTrait;
          
              const TYPE_ORGANIZATION = 1;
          Severity: Minor
          Found in Organization.php by phpmd

          CouplingBetweenObjects

          Since: 1.1.0

          A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

          Example

          class Foo {
              /**
               * @var \foo\bar\X
               */
              private $x = null;
          
              /**
               * @var \foo\bar\Y
               */
              private $y = null;
          
              /**
               * @var \foo\bar\Z
               */
              private $z = null;
          
              public function setFoo(\Foo $foo) {}
              public function setBar(\Bar $bar) {}
              public function setBaz(\Baz $baz) {}
          
              /**
               * @return \SplObjectStorage
               * @throws \OutOfRangeException
               * @throws \InvalidArgumentException
               * @throws \ErrorException
               */
              public function process(\Iterator $it) {}
          
              // ...
          }

          Source https://phpmd.org/rules/design.html#couplingbetweenobjects

          The method setSetting has a boolean flag argument $unique, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function setSetting($item, $value, $unique = false)
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method setIsOnlyAcceptCurrentOrgMember has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function setIsOnlyAcceptCurrentOrgMember($value = true)
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method setIsDisallowMemberJoinOther has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function setIsDisallowMemberJoinOther($value = true)
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method setIsExcludeOtherMembers has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function setIsExcludeOtherMembers($value = true)
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method removeAdministrator has a boolean flag argument $keep, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function removeAdministrator(&$member, $keep = true)
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method setIsOnlyAcceptSuperiorOrgMember has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function setIsOnlyAcceptSuperiorOrgMember($value = true)
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

          The method setExitAllowWithdrawActively has a boolean flag argument $value, which is a certain sign of a Single Responsibility Principle violation.
          Open

              public function setExitAllowWithdrawActively($value = false)
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanArgumentFlag

          Since: 1.4.0

          A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

          Example

          class Foo {
              public function bar($flag = true) {
              }
          }

          Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

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

                      'isOnlyAcceptCurrentOrgMember' => Yii::t('organization', 'Only Accept Current Organization Members'),
          Severity: Minor
          Found in Organization.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 Organization.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

                      'isOnlyAcceptSuperiorOrgMember' => Yii::t('organization', 'Only Accept Superior Organization Members'),
          Severity: Minor
          Found in Organization.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 'addMember'.
          Open

                      throw new OnlyAcceptSuperiorOrgMemberException(Yii::t('organization', 'This department only accepts members of the parent organization or department.'));
          Severity: Minor
          Found in Organization.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

                      'type' => Yii::t('user', 'Type'),
          Severity: Minor
          Found in Organization.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 'addMember'.
          Open

                      throw new OnlyAcceptCurrentOrgMemberException(Yii::t('organization' ,'This department is only accepted by members of the organization.'));
          Severity: Minor
          Found in Organization.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 Organization.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 'addMember'.
          Open

                          throw new ExcludeOtherMembersException(Yii::t('organization', "The organization does not allow users who have joined other organizations to join."));
          Severity: Minor
          Found in Organization.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 'addAdministrator'.
          Open

                          throw new IntegrityException(Yii::t('organization', 'Failed to add member.'));
          Severity: Minor
          Found in Organization.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->createdAtAttribute => Yii::t('user', 'Creation Time'),
          Severity: Minor
          Found in Organization.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->idAttribute => Yii::t('user', 'ID'),
          Severity: Minor
          Found in Organization.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

                      'isExcludeOtherMembers' => Yii::t('organization', 'Exclude Other Members'),
          Severity: Minor
          Found in Organization.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->ipAttribute => Yii::t('user', 'IP Address'),
          Severity: Minor
          Found in Organization.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 'addCreator'.
          Open

                      Yii::error($ex->getMessage(), __METHOD__);
          Severity: Minor
          Found in Organization.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 'addAdministrator'.
          Open

                      Yii::error($ex->getMessage(), __METHOD__);
          Severity: Minor
          Found in Organization.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 Organization.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->parentAttribute => Yii::t('organization', 'Parent'),
          Severity: Minor
          Found in Organization.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 'addMember'.
          Open

                          throw new DisallowMemberJoinOtherException(Yii::t('organization', "An organization in which the user is located does not allow its members to join other organizations."));
          Severity: Minor
          Found in Organization.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->statusAttribute => Yii::t('user', 'Status'),
          Severity: Minor
          Found in Organization.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

                      'isDisallowMemberJoinOther' => Yii::t('organization', 'Disallow Member to Join in Other Organizations'),
          Severity: Minor
          Found in Organization.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 unused parameters such as '$event'.
          Open

              public function onRevokePermissions($event)
          Severity: Minor
          Found in Organization.php by phpmd

          UnusedFormalParameter

          Since: 0.2

          Avoid passing parameters to methods or constructors and then not using those parameters.

          Example

          class Foo
          {
              private function bar($howdy)
              {
                  // $howdy is not used
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

          Avoid excessively long variable names like $passwordHashAttribute. Keep variable name length under 20.
          Open

              public $passwordHashAttribute = false;
          Severity: Minor
          Found in Organization.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $passwordResetTokenAttribute. Keep variable name length under 20.
          Open

              public $passwordResetTokenAttribute = false;
          Severity: Minor
          Found in Organization.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $noInitOrganizationSetting. Keep variable name length under 20.
          Open

              private $noInitOrganizationSetting;
          Severity: Minor
          Found in Organization.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $noInitSubordinateLimit. Keep variable name length under 20.
          Open

              private $noInitSubordinateLimit;
          Severity: Minor
          Found in Organization.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $subordinateLimitClass. Keep variable name length under 20.
          Open

              public $subordinateLimitClass = SubordinateLimit::class;
          Severity: Minor
          Found in Organization.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Avoid excessively long variable names like $organizationSettingClass. Keep variable name length under 20.
          Open

              public $organizationSettingClass = OrganizationSetting::class;
          Severity: Minor
          Found in Organization.php by phpmd

          LongVariable

          Since: 0.2

          Detects when a field, formal or local variable is declared with a long name.

          Example

          class Something {
              protected $reallyLongIntName = -3; // VIOLATION - Field
              public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                  $otherReallyLongName = -5; // VIOLATION - Local
                  for ($interestingIntIndex = 0; // VIOLATION - For
                       $interestingIntIndex < 10;
                       $interestingIntIndex++ ) {
                  }
              }
          }

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

          Function closing brace must go on the next line following the body; found 1 blank lines before brace
          Open

              }
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Space found before comma in function call
          Open

                      throw new OnlyAcceptCurrentOrgMemberException(Yii::t('organization' ,'This department is only accepted by members of the organization.'));
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          The 'getIsOnlyAcceptSuperiorOrgMember()' method which returns a boolean should be named 'is...()' or 'has...()'
          Open

              public function getIsOnlyAcceptSuperiorOrgMember()
              {
                  if ($this->parent && $this->parent->equals($this->topOrganization)) {
                      return $this->getIsOnlyAcceptCurrentOrgMember();
                  }
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanGetMethodName

          Since: 0.2

          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

          Example

          class Foo {
              /**
               * @return boolean
               */
              public function getFoo() {} // bad
              /**
               * @return bool
               */
              public function isFoo(); // ok
              /**
               * @return boolean
               */
              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
          }

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

          The 'getIsExcludeOtherMembers()' method which returns a boolean should be named 'is...()' or 'has...()'
          Open

              public function getIsExcludeOtherMembers()
              {
                  $setting = $this->getSettings(static::SETTING_ITEM_EXCLUDE_OTHER_MEMBERS)->one();
                  if (!$setting) {
                      $this->setIsExcludeOtherMembers(false);
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanGetMethodName

          Since: 0.2

          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

          Example

          class Foo {
              /**
               * @return boolean
               */
              public function getFoo() {} // bad
              /**
               * @return bool
               */
              public function isFoo(); // ok
              /**
               * @return boolean
               */
              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
          }

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

          The 'getIsOnlyAcceptCurrentOrgMember()' method which returns a boolean should be named 'is...()' or 'has...()'
          Open

              public function getIsOnlyAcceptCurrentOrgMember()
              {
                  $setting = $this->getSettings(static::SETTING_ITEM_ONLY_ACCEPT_CURRENT_ORG_MEMBER)->one();
                  if (!$setting) {
                      $this->setIsOnlyAcceptCurrentOrgMember(false);
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanGetMethodName

          Since: 0.2

          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

          Example

          class Foo {
              /**
               * @return boolean
               */
              public function getFoo() {} // bad
              /**
               * @return bool
               */
              public function isFoo(); // ok
              /**
               * @return boolean
               */
              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
          }

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

          The 'getIsDisallowMemberJoinOther()' method which returns a boolean should be named 'is...()' or 'has...()'
          Open

              public function getIsDisallowMemberJoinOther()
              {
                  $setting = $this->getSettings(static::SETTING_ITEM_DISALLOW_MEMBER_JOIN_OTHER)->one();
                  if (!$setting) {
                      $this->setIsDisallowMemberJoinOther(false);
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanGetMethodName

          Since: 0.2

          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

          Example

          class Foo {
              /**
               * @return boolean
               */
              public function getFoo() {} // bad
              /**
               * @return bool
               */
              public function isFoo(); // ok
              /**
               * @return boolean
               */
              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
          }

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

          The 'getExitAllowWithdrawActively()' method which returns a boolean should be named 'is...()' or 'has...()'
          Open

              public function getExitAllowWithdrawActively()
              {
                  $setting = $this->getSettings(static::SETTING_ITEM_EXIT_ALLOW_WITHDRAW_ACTIVELY)->one();
                  if (!$setting) {
                      $this->setExitAllowWithdrawActively();
          Severity: Minor
          Found in Organization.php by phpmd

          BooleanGetMethodName

          Since: 0.2

          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

          Example

          class Foo {
              /**
               * @return boolean
               */
              public function getFoo() {} // bad
              /**
               * @return bool
               */
              public function isFoo(); // ok
              /**
               * @return boolean
               */
              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
          }

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

          Line exceeds 120 characters; contains 125 characters
          Open

                      if ($org->topOrganization->isDisallowMemberJoinOther && !$org->topOrganization->equals($this->topOrganization)) {
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Line exceeds 120 characters; contains 122 characters
          Open

                      if ($this->topOrganization->isExcludeOtherMembers && !$org->topOrganization->equals($this->topOrganization)) {
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Line exceeds 120 characters; contains 150 characters
          Open

                  $query = $this->hasMany($this->organizationSettingClass, [$this->getNoInitOrganizationSetting()->createdByAttribute => $this->guidAttribute]);
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Line exceeds 120 characters; contains 123 characters
          Open

                  return $this->getMembers()->andWhere(['role' => [(new DepartmentCreator)->name, (new OrganizationCreator)->name]]);
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Line exceeds 120 characters; contains 162 characters
          Open

                  if ($this->isDepartment() && !$this->parent->equals($this->topOrganization) && $this->isOnlyAcceptSuperiorOrgMember && !$this->parent->hasMember($user)) {
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Line exceeds 120 characters; contains 187 characters
          Open

                          throw new DisallowMemberJoinOtherException(Yii::t('organization', "An organization in which the user is located does not allow its members to join other organizations."));
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Line exceeds 120 characters; contains 150 characters
          Open

                      throw new OnlyAcceptCurrentOrgMemberException(Yii::t('organization' ,'This department is only accepted by members of the organization.'));
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Line exceeds 120 characters; contains 165 characters
          Open

                      throw new OnlyAcceptSuperiorOrgMemberException(Yii::t('organization', 'This department only accepts members of the parent organization or department.'));
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Line exceeds 120 characters; contains 165 characters
          Open

                          throw new ExcludeOtherMembersException(Yii::t('organization', "The organization does not allow users who have joined other organizations to join."));
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Expected 1 space after closing parenthesis; found 9
          Open

                  foreach ($members as $member)
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Whitespace found at end of line
          Open

               * 
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Whitespace found at end of line
          Open

               * 
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Whitespace found at end of line
          Open

               * 
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Whitespace found at end of line
          Open

               * 
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          No space found after comma in function call
          Open

                      throw new OnlyAcceptCurrentOrgMemberException(Yii::t('organization' ,'This department is only accepted by members of the organization.'));
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Whitespace found at end of line
          Open

               * 
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          Whitespace found at end of line
          Open

               * 
          Severity: Minor
          Found in Organization.php by phpcodesniffer

          There are no issues that match your filters.

          Category
          Status