qcubed/framework

View on GitHub
includes/base_controls/QListControl.class.php

Summary

Maintainability
D
2 days
Test Coverage

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

    abstract class QListControl extends QControl {

        use QListItemManager;

        /** @var null|QListItemStyle The common style for all elements in the list */

Function SetSelectedItemsByValue has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

        public function SetSelectedItemsByValue(array $mixValueArray, $blnRefresh = true) {
            $intCount = $this->GetItemCount();

            for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                $objItem = $this->GetItem($intIndex);
Severity: Minor
Found in includes/base_controls/QListControl.class.php - About 3 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

File QListControl.class.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
    /**
     * This file contains the QListControl class.
     * 
     * @package Controls
Severity: Minor
Found in includes/base_controls/QListControl.class.php - About 2 hrs to fix

    Method __get has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function __get($strName) {
                switch ($strName) {
                    case "ItemCount":
                        return $this->GetItemCount();
    
    
    Severity: Major
    Found in includes/base_controls/QListControl.class.php - About 2 hrs to fix

      Method __set has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function __set($strName, $mixValue) {
                  switch ($strName) {
                      case "SelectedIndex":
                          try {
                              $mixValue = QType::Cast($mixValue, QType::Integer);
      Severity: Major
      Found in includes/base_controls/QListControl.class.php - About 2 hrs to fix

        Function __get has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                public function __get($strName) {
                    switch ($strName) {
                        case "ItemCount":
                            return $this->GetItemCount();
        
        
        Severity: Minor
        Found in includes/base_controls/QListControl.class.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

        Function __set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                public function __set($strName, $mixValue) {
                    switch ($strName) {
                        case "SelectedIndex":
                            try {
                                $mixValue = QType::Cast($mixValue, QType::Integer);
        Severity: Minor
        Found in includes/base_controls/QListControl.class.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

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

                public function AddItems(array $mixItemArray, $mixSelectedValues = null, $strItemGroup = null, $mixOverrideParameters = null) {
                    try {
                        $mixItemArray = QType::Cast($mixItemArray, QType::ArrayType);
                    } catch (QInvalidCastException $objExc) {
                        $objExc->IncrementOffset();
        Severity: Minor
        Found in includes/base_controls/QListControl.class.php - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Method AddItem has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                public function AddItem($mixListItemOrName, $strValue = null, $blnSelected = null, $strItemGroup = null, $mixOverrideParameters = null) {
        Severity: Minor
        Found in includes/base_controls/QListControl.class.php - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

                                  return $objItem->Value;
          Severity: Major
          Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                    return parent::__get($strName);
            Severity: Major
            Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return null;
              Severity: Major
              Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                        return $this->GetItem (0);
                Severity: Major
                Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return $this->objItemStyle;
                  Severity: Major
                  Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return null;
                    Severity: Major
                    Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return $values;
                      Severity: Major
                      Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                                return $objItem->Name;
                        Severity: Major
                        Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                              return null;
                          Severity: Major
                          Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return $mixValues;
                            Severity: Major
                            Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                  return $strNamesArray;
                              Severity: Major
                              Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                    return $this->GetSelectedItems();
                                Severity: Major
                                Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                      return null;
                                  Severity: Major
                                  Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                            return $objItem;
                                    Severity: Major
                                    Found in includes/base_controls/QListControl.class.php - About 30 mins to fix

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

                                              public function __get($strName) {
                                                  switch ($strName) {
                                                      case "ItemCount":
                                                          return $this->GetItemCount();
                                      
                                      

                                      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 method SetSelectedItemsByValue() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                                      Open

                                              public function SetSelectedItemsByValue(array $mixValueArray, $blnRefresh = true) {
                                                  $intCount = $this->GetItemCount();
                                      
                                                  for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                                                      $objItem = $this->GetItem($intIndex);

                                      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 method __set() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
                                      Open

                                              public function __set($strName, $mixValue) {
                                                  switch ($strName) {
                                                      case "SelectedIndex":
                                                          try {
                                                              $mixValue = QType::Cast($mixValue, QType::Integer);

                                      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

                                      Missing class import via use statement (line '42', column '24').
                                      Open

                                                      $objListItem = new QListItem($mixListItemOrName, $strValue, $blnSelected, $strItemGroup, $mixOverrideParameters);

                                      MissingImport

                                      Since: 2.7.0

                                      Importing all external classes in a file through use statements makes them clearly visible.

                                      Example

                                      function make() {
                                          return new \stdClass();
                                      }

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

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

                                              public function SetSelectedItemsById(array $strIdArray, $blnRefresh = true) {

                                      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 UnselectAllItems has a boolean flag argument $blnRefresh, which is a certain sign of a Single Responsibility Principle violation.
                                      Open

                                              public function UnselectAllItems($blnRefresh = true) {

                                      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 SetSelectedItemsByName has a boolean flag argument $blnRefresh, which is a certain sign of a Single Responsibility Principle violation.
                                      Open

                                              public function SetSelectedItemsByName(array $strNameArray, $blnRefresh = true) {

                                      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

                                      Missing class import via use statement (line '372', column '17').
                                      Open

                                                              throw new QIndexOutOfRangeException($mixValue, "SelectedIndex");

                                      MissingImport

                                      Since: 2.7.0

                                      Importing all external classes in a file through use statements makes them clearly visible.

                                      Example

                                      function make() {
                                          return new \stdClass();
                                      }

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

                                      Missing class import via use statement (line '45', column '24').
                                      Open

                                                      $objListItem = new QListItem($mixListItemOrName, $strValue, $blnSelected, $strItemGroup);

                                      MissingImport

                                      Since: 2.7.0

                                      Importing all external classes in a file through use statements makes them clearly visible.

                                      Example

                                      function make() {
                                          return new \stdClass();
                                      }

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

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

                                              public function SetSelectedItemsByIndex(array $intIndexArray, $blnRefresh = true) {

                                      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 SetSelectedItemsByValue has a boolean flag argument $blnRefresh, which is a certain sign of a Single Responsibility Principle violation.
                                      Open

                                              public function SetSelectedItemsByValue(array $mixValueArray, $blnRefresh = true) {

                                      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

                                      Missing class import via use statement (line '436', column '9').
                                      Open

                                                      new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'NoAutoLoad', 'Prevent automatically populating a list type control. Set this if you are doing more complex list loading.', QType::Boolean)

                                      MissingImport

                                      Since: 2.7.0

                                      Importing all external classes in a file through use statements makes them clearly visible.

                                      Example

                                      function make() {
                                          return new \stdClass();
                                      }

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

                                      Avoid using static access to class 'QType' in method 'AddItems'.
                                      Open

                                                      $mixItemArray = QType::Cast($mixItemArray, QType::ArrayType);

                                      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 'QType' in method 'AddItem'.
                                      Open

                                                      $objListItem = QType::Cast($mixListItemOrName, "QListItem");

                                      StaticAccess

                                      Since: 1.4.0

                                      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                      Example

                                      class Foo
                                      {
                                          public function bar()
                                          {
                                              Bar::baz();
                                          }
                                      }

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

                                      Avoid assigning values to variables in if clauses and the like (line '295', column '10').
                                      Open

                                              public function __get($strName) {
                                                  switch ($strName) {
                                                      case "ItemCount":
                                                          return $this->GetItemCount();
                                      
                                      

                                      IfStatementAssignment

                                      Since: 2.7.0

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

                                      Example

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

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

                                      Avoid assigning values to variables in if clauses and the like (line '302', column '10').
                                      Open

                                              public function __get($strName) {
                                                  switch ($strName) {
                                                      case "ItemCount":
                                                          return $this->GetItemCount();
                                      
                                      

                                      IfStatementAssignment

                                      Since: 2.7.0

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

                                      Example

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

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

                                      Avoid using static access to class 'QType' in method '__set'.
                                      Open

                                                              $this->objItemStyle = QType::Cast($mixValue, "QListItemStyle");

                                      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

                                      The method AddItem uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                      Open

                                                  else {
                                                      $objListItem = new QListItem($mixListItemOrName, $strValue, $blnSelected, $strItemGroup);
                                                  }

                                      ElseExpression

                                      Since: 1.4.0

                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                      Example

                                      class Foo
                                      {
                                          public function bar($flag)
                                          {
                                              if ($flag) {
                                                  // one branch
                                              } else {
                                                  // another branch
                                              }
                                          }
                                      }

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

                                      The method AddItems uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                      Open

                                                      } else {
                                                          $blnSelected = ($val === $mixSelectedValues);    // differentiate between null and 0 values
                                                      }

                                      ElseExpression

                                      Since: 1.4.0

                                      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                      Example

                                      class Foo
                                      {
                                          public function bar($flag)
                                          {
                                              if ($flag) {
                                                  // one branch
                                              } else {
                                                  // another branch
                                              }
                                          }
                                      }

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

                                      Avoid assigning values to variables in if clauses and the like (line '308', column '10').
                                      Open

                                              public function __get($strName) {
                                                  switch ($strName) {
                                                      case "ItemCount":
                                                          return $this->GetItemCount();
                                      
                                      

                                      IfStatementAssignment

                                      Since: 2.7.0

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

                                      Example

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

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

                                      Avoid using static access to class 'QType' in method '__set'.
                                      Open

                                                              $mixValue = QType::Cast($mixValue, QType::ArrayType);

                                      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 'QType' in method '__set'.
                                      Open

                                                              $mixValue = QType::Cast($mixValue, QType::Integer);

                                      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 'QType' in method '__set'.
                                      Open

                                                              $mixValues = QType::Cast($mixValue, QType::ArrayType);

                                      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 excessively long variable names like $mixOverrideParameters. Keep variable name length under 20.
                                      Open

                                              public function AddItem($mixListItemOrName, $strValue = null, $blnSelected = null, $strItemGroup = null, $mixOverrideParameters = null) {

                                      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 $mixOverrideParameters. Keep variable name length under 20.
                                      Open

                                              public function AddItems(array $mixItemArray, $mixSelectedValues = null, $strItemGroup = null, $mixOverrideParameters = null) {

                                      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 method AddItems is not named in camelCase.
                                      Open

                                              public function AddItems(array $mixItemArray, $mixSelectedValues = null, $strItemGroup = null, $mixOverrideParameters = null) {
                                                  try {
                                                      $mixItemArray = QType::Cast($mixItemArray, QType::ArrayType);
                                                  } catch (QInvalidCastException $objExc) {
                                                      $objExc->IncrementOffset();

                                      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

                                      The method GetId is not named in camelCase.
                                      Open

                                              public function GetId() {
                                                  return $this->strControlId;
                                              }

                                      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

                                      The method SetSelectedItemsByIndex is not named in camelCase.
                                      Open

                                              public function SetSelectedItemsByIndex(array $intIndexArray, $blnRefresh = true) {
                                                  $intCount = $this->GetItemCount();
                                                  for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                                                      $objItem = $this->GetItem($intIndex);
                                                      $objItem->Selected = in_array($intIndex, $intIndexArray);

                                      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

                                      The method UnselectAllItems is not named in camelCase.
                                      Open

                                              public function UnselectAllItems($blnRefresh = true) {
                                                  $intCount = $this->GetItemCount();
                                                  for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                                                      $objItem = $this->GetItem($intIndex);
                                                      $objItem->Selected = false;

                                      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

                                      The method SetSelectedItemsById is not named in camelCase.
                                      Open

                                              public function SetSelectedItemsById(array $strIdArray, $blnRefresh = true) {
                                                  $intCount = $this->GetItemCount();
                                                  for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                                                      $objItem = $this->GetItem($intIndex);
                                                      $strId = $objItem->GetId();

                                      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

                                      The method GetFirstSelectedItem is not named in camelCase.
                                      Open

                                              public function GetFirstSelectedItem() {
                                                  $intCount = $this->GetItemCount();
                                                  for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                                                      $objItem = $this->GetItem($intIndex);
                                                      if ($objItem->Selected) {

                                      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

                                      The method RefreshSelection is not named in camelCase.
                                      Open

                                              protected function RefreshSelection() {
                                                  $this->MarkAsModified();
                                              }

                                      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

                                      The method SetSelectedItemsByValue is not named in camelCase.
                                      Open

                                              public function SetSelectedItemsByValue(array $mixValueArray, $blnRefresh = true) {
                                                  $intCount = $this->GetItemCount();
                                      
                                                  for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                                                      $objItem = $this->GetItem($intIndex);

                                      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

                                      The method PutState is not named in camelCase.
                                      Open

                                              public function PutState($state) {
                                                  if (!empty($state['SelectedValues'])) {
                                                      $this->SelectedValues = $state['SelectedValues'];
                                                  }
                                              }

                                      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

                                      The method GetModelConnectorParams is not named in camelCase.
                                      Open

                                              public static function GetModelConnectorParams() {
                                                  return array_merge(parent::GetModelConnectorParams(), array(
                                                      new QModelConnectorParam (QModelConnectorParam::GeneralCategory, 'NoAutoLoad', 'Prevent automatically populating a list type control. Set this if you are doing more complex list loading.', QType::Boolean)
                                                  ));
                                              }

                                      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

                                      The method AddItem is not named in camelCase.
                                      Open

                                              public function AddItem($mixListItemOrName, $strValue = null, $blnSelected = null, $strItemGroup = null, $mixOverrideParameters = null) {
                                                  if (gettype($mixListItemOrName) == QType::Object) {
                                                      $objListItem = QType::Cast($mixListItemOrName, "QListItem");
                                                  }
                                                  elseif ($mixOverrideParameters) {

                                      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

                                      The method GetSelectedItems is not named in camelCase.
                                      Open

                                              public function GetSelectedItems() {
                                                  $aResult = array();
                                                  $intCount = $this->GetItemCount();
                                                  for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                                                      $objItem = $this->GetItem($intIndex);

                                      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

                                      The method SetSelectedItemsByName is not named in camelCase.
                                      Open

                                              public function SetSelectedItemsByName(array $strNameArray, $blnRefresh = true) {
                                                  $intCount = $this->GetItemCount();
                                                  for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
                                                      $objItem = $this->GetItem($intIndex);
                                                      $strName = $objItem->Name;

                                      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

                                      The method GetState is not named in camelCase.
                                      Open

                                              public function GetState(){
                                                  return array('SelectedValues'=>$this->SelectedValues);
                                              }

                                      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