rhosocial/yii2-organization

View on GitHub
forms/SettingsForm.php

Summary

Maintainability
B
4 hrs
Test Coverage

Function submit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function submit()
    {
        try {
            if ($this->organization->isOrganization()) {
                if ($this->exclude_other_members != ($this->organization->isExcludeOtherMembers ? '1' : '0')) {
Severity: Minor
Found in forms/SettingsForm.php - About 1 hr 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 attributeHints has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function attributeHints()
    {
        $topName = $this->organization->isDepartment() ? $this->organization->topOrganization->profile->name . ' (' . $this->organization->topOrganization->getID() . ')' : '';
        $parentName = $this->organization->isDepartment() ? $this->organization->parent->profile->name . ' (' . $this->organization->parent->getID() . ')' : '';
        return [
Severity: Minor
Found in forms/SettingsForm.php - About 1 hr to fix

    Method submit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function submit()
        {
            try {
                if ($this->organization->isOrganization()) {
                    if ($this->exclude_other_members != ($this->organization->isExcludeOtherMembers ? '1' : '0')) {
    Severity: Minor
    Found in forms/SettingsForm.php - About 1 hr to fix

      The method submit() has an NPath complexity of 1057. The configured NPath complexity threshold is 200.
      Open

          public function submit()
          {
              try {
                  if ($this->organization->isOrganization()) {
                      if ($this->exclude_other_members != ($this->organization->isExcludeOtherMembers ? '1' : '0')) {
      Severity: Minor
      Found in forms/SettingsForm.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 submit() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
      Open

          public function submit()
          {
              try {
                  if ($this->organization->isOrganization()) {
                      if ($this->exclude_other_members != ($this->organization->isExcludeOtherMembers ? '1' : '0')) {
      Severity: Minor
      Found in forms/SettingsForm.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

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

                  'exclude_other_members' => Yii::t('organization', 'Exclude other members'),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'That is to say, only the members of {name} are accepted.', ['name' => $topName]),
      Severity: Minor
      Found in forms/SettingsForm.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\Html' in method 'attributeHints'.
      Open

                      (empty($this->join_entrance_url) ? Yii::t('organization', 'No entrance URL is currently available.') : Html::a(Yii::t('organization', 'The entrance URL'), [
                              '/organization/join/index',
                              'entrance' => $this->join_entrance_url,
                      ], [
                          'class' => 'btn btn-primary',
      Severity: Minor
      Found in forms/SettingsForm.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

                  'join_password' => Yii::t('organization', 'Password'),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'All members of this organization (including subordinate departments) who have joined other organizations (including their subordinates) are not affected.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'That is to say, only the members of {name} are accepted.', ['name' => $parentName]),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'All members of the other organizations (including their subordinates) who have joined this organization (including subordinate departments) are not affected.'),
      Severity: Minor
      Found in forms/SettingsForm.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

                  'join_entrance_url' => Yii::t('organization', 'Entrance URL Code'),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'After you enter the code and submit it, the generated URL will appear below.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      (empty($this->join_entrance_url) ? Yii::t('organization', 'No entrance URL is currently available.') : Html::a(Yii::t('organization', 'The entrance URL'), [
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'If you do not restrict the IP address (segment), leave it blank.'),
      Severity: Minor
      Found in forms/SettingsForm.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 'setting_unique'.
      Open

                  $this->addError($attribute, Yii::t('organization', "{value} already exists.", ['value' => $value]));
      Severity: Minor
      Found in forms/SettingsForm.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

                  'exit_allow_withdraw_actively' => Yii::t('organization', 'Allow to Withdraw Actively'),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'If you specify a password, the user needs to provide the password to join.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'This department is only accepted by members of the organization.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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

                  'join_ip_address' => Yii::t('organization', 'IP Address'),
      Severity: Minor
      Found in forms/SettingsForm.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

                  'disallow_member_join_other' => Yii::t('organization', 'Disallow members to join other'),
      Severity: Minor
      Found in forms/SettingsForm.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

                  'only_accept_superior_org_member' => Yii::t('organization', 'Only accept superior members'),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'If you do not need a user to enter a password, leave it blank.'),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'If this option is enabled, all members of the organization (including subordinate departments) who have the "Set Up Organization" permission will not be able to set up a new organization.'),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'This department only accepts members of the parent organization or department.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'Only the users from the above IP address (segment) can join the organization / department proactively.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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

                  'only_accept_current_org_member' => Yii::t('organization', 'Only accept organization members'),
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'This organization does not allow other organizations and their subordinates\' members to join.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'This organization does not allow the organization and its subordinates\' members to join other organizations or their subordinates.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'If you do not want users to join the ' . ($this->organization->isOrganization() ? 'organization' : 'department') . ', please leave blank.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                  'join_entrance_url' => Yii::t('organization', 'You can assign a unique code to the ' . ($this->organization->isOrganization() ? 'organization' : 'department') . ', and we will generate a unique entrance URL based on this code.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      Yii::t('organization', 'For example, the local address segment is {ip}.', ['ip' => '127.0.0.0/8']) . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.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 'attributeHints'.
      Open

                      (empty($this->join_entrance_url) ? Yii::t('organization', 'No entrance URL is currently available.') : Html::a(Yii::t('organization', 'The entrance URL'), [
      Severity: Minor
      Found in forms/SettingsForm.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 '$validator'.
      Open

          public function setting_unique($attribute, $params, $validator)
      Severity: Minor
      Found in forms/SettingsForm.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 $disallow_member_join_other. Keep variable name length under 20.
      Open

          public $disallow_member_join_other;
      Severity: Minor
      Found in forms/SettingsForm.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 $only_accept_superior_org_member. Keep variable name length under 20.
      Open

          public $only_accept_superior_org_member;
      Severity: Minor
      Found in forms/SettingsForm.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 $exit_allow_withdraw_actively. Keep variable name length under 20.
      Open

          public $exit_allow_withdraw_actively;
      Severity: Minor
      Found in forms/SettingsForm.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 $exclude_other_members. Keep variable name length under 20.
      Open

          public $exclude_other_members;
      Severity: Minor
      Found in forms/SettingsForm.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 $only_accept_current_org_member. Keep variable name length under 20.
      Open

          public $only_accept_current_org_member;
      Severity: Minor
      Found in forms/SettingsForm.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

      The property $exit_allow_withdraw_actively is not named in camelCase.
      Open

      class SettingsForm extends Model
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in forms/SettingsForm.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

      The property $join_ip_address is not named in camelCase.
      Open

      class SettingsForm extends Model
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in forms/SettingsForm.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

      The property $only_accept_superior_org_member is not named in camelCase.
      Open

      class SettingsForm extends Model
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in forms/SettingsForm.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

      The property $join_password is not named in camelCase.
      Open

      class SettingsForm extends Model
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in forms/SettingsForm.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

      The property $disallow_member_join_other is not named in camelCase.
      Open

      class SettingsForm extends Model
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in forms/SettingsForm.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

      The property $exclude_other_members is not named in camelCase.
      Open

      class SettingsForm extends Model
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in forms/SettingsForm.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

      The property $only_accept_current_org_member is not named in camelCase.
      Open

      class SettingsForm extends Model
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in forms/SettingsForm.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

      The property $join_entrance_url is not named in camelCase.
      Open

      class SettingsForm extends Model
      {
          /**
           * @var string
           */
      Severity: Minor
      Found in forms/SettingsForm.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

      Method name "SettingsForm::setting_unique" is not in camel caps format
      Open

          public function setting_unique($attribute, $params, $validator)
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 200 characters
      Open

                      Yii::t('organization', 'All members of the other organizations (including their subordinates) who have joined this organization (including subordinate departments) are not affected.'),
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 143 characters
      Open

                  ['join_entrance_url', 'setting_unique', 'skipOnError' => false, 'params' => ['item' => $orgClass::SETTING_ITEM_JOIN_ENTRANCE_URL]],
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 131 characters
      Open

                      Yii::t('organization', 'This department only accepts members of the parent organization or department.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 155 characters
      Open

                      Yii::t('organization', 'Only the users from the above IP address (segment) can join the organization / department proactively.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 121 characters
      Open

                      Yii::t('organization', 'That is to say, only the members of {name} are accepted.', ['name' => $topName]),
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 126 characters
      Open

              $this->scenario = $this->organization->isOrganization() ? static::SCENARIO_ORGANIZATION : static::SCENARIO_DEPARTMENT;
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 184 characters
      Open

                      Yii::t('organization', 'This organization does not allow the organization and its subordinates\' members to join other organizations or their subordinates.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 172 characters
      Open

                      (empty($this->join_entrance_url) ? Yii::t('organization', 'No entrance URL is currently available.') : Html::a(Yii::t('organization', 'The entrance URL'), [
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 127 characters
      Open

                      if ($this->only_accept_current_org_member != ($this->organization->isOnlyAcceptCurrentOrgMember ? '1' : '0')) {
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 175 characters
      Open

              $topName = $this->organization->isDepartment() ? $this->organization->topOrganization->profile->name . ' (' . $this->organization->topOrganization->getID() . ')' : '';
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 190 characters
      Open

                      Yii::t('organization', 'If you do not want users to join the ' . ($this->organization->isOrganization() ? 'organization' : 'department') . ', please leave blank.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 223 characters
      Open

                  [['exclude_other_members', 'disallow_member_join_other', 'only_accept_current_org_member', 'only_accept_superior_org_member', 'exit_allow_withdraw_actively'], 'boolean', 'trueValue' => '1', 'falseValue' => '0'],
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 147 characters
      Open

                      Yii::t('organization', 'This organization does not allow other organizations and their subordinates\' members to join.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 206 characters
      Open

                      Yii::t('organization', 'All members of this organization (including subordinate departments) who have joined other organizations (including their subordinates) are not affected.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 230 characters
      Open

                      Yii::t('organization', 'If this option is enabled, all members of the organization (including subordinate departments) who have the "Set Up Organization" permission will not be able to set up a new organization.'),
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 129 characters
      Open

                      Yii::t('organization', 'After you enter the code and submit it, the generated URL will appear below.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 127 characters
      Open

                      Yii::t('organization', 'If you specify a password, the user needs to provide the password to join.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 125 characters
      Open

                      Yii::t('organization', 'For example, the local address segment is {ip}.', ['ip' => '127.0.0.0/8']) . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 251 characters
      Open

                  'join_entrance_url' => Yii::t('organization', 'You can assign a unique code to the ' . ($this->organization->isOrganization() ? 'organization' : 'department') . ', and we will generate a unique entrance URL based on this code.') . "<br>" .
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 129 characters
      Open

                      if ($this->only_accept_superior_org_member != ($this->organization->isOnlyAcceptSuperiorOrgMember ? '1' : '0')) {
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 160 characters
      Open

              $parentName = $this->organization->isDepartment() ? $this->organization->parent->profile->name . ' (' . $this->organization->parent->getID() . ')' : '';
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 121 characters
      Open

                          $this->organization->isOnlyAcceptSuperiorOrgMember = ($this->only_accept_superior_org_member == '1');
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      Line exceeds 120 characters; contains 124 characters
      Open

                      Yii::t('organization', 'That is to say, only the members of {name} are accepted.', ['name' => $parentName]),
      Severity: Minor
      Found in forms/SettingsForm.php by phpcodesniffer

      The method setting_unique is not named in camelCase.
      Open

          public function setting_unique($attribute, $params, $validator)
          {
              $value = (string)$this->$attribute;
              if (empty($value)) {
                  return;
      Severity: Minor
      Found in forms/SettingsForm.php by phpmd

      CamelCaseMethodName

      Since: 0.2

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

      Example

      class ClassName {
          public function get_name() {
          }
      }

      Source

      There are no issues that match your filters.

      Category
      Status