qcubed/framework

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

Summary

Maintainability
F
4 days
Test Coverage

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

        public function __set($strName, $mixValue) {
            switch ($strName) {
                // APPEARANCE
                case "TextAlign":
                    try {
Severity: Minor
Found in includes/base_controls/QCheckBoxList.class.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

        public function __set($strName, $mixValue) {
            switch ($strName) {
                // APPEARANCE
                case "TextAlign":
                    try {
Severity: Major
Found in includes/base_controls/QCheckBoxList.class.php - About 4 hrs to fix

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

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

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

          class QCheckBoxList extends QListControl {
              
              const ButtonModeNone = 0;    // Uses the RepeatColumns and RepeateDirection settings to make a structure
              const ButtonModeJq = 1;        // a list of individual jquery ui buttons
              const ButtonModeSet = 2;    // a jqueryui button set

      Function RenderButtonTable has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

              public function RenderButtonTable() {
                  $strToReturn = '';
                  if ($this->ItemCount > 0) {
                      // Figure out the number of ROWS for this table
                      $intRowCount = floor($this->ItemCount / $this->intRepeatColumns);
      Severity: Minor
      Found in includes/base_controls/QCheckBoxList.class.php - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method GetItemHtml has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              protected function GetItemHtml(QListItem $objItem, $intIndex, $strTabIndex, $blnWrapLabel) {
                  $objLabelStyles = new QTagStyler();
                  if ($this->objItemStyle) {
                      $objLabelStyles->Override($this->objItemStyle); // default style
                  }
      Severity: Minor
      Found in includes/base_controls/QCheckBoxList.class.php - About 1 hr to fix

        Method RenderButtonTable has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function RenderButtonTable() {
                    $strToReturn = '';
                    if ($this->ItemCount > 0) {
                        // Figure out the number of ROWS for this table
                        $intRowCount = floor($this->ItemCount / $this->intRepeatColumns);
        Severity: Minor
        Found in includes/base_controls/QCheckBoxList.class.php - About 1 hr to fix

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

                  protected function GetItemHtml(QListItem $objItem, $intIndex, $strTabIndex, $blnWrapLabel) {
                      $objLabelStyles = new QTagStyler();
                      if ($this->objItemStyle) {
                          $objLabelStyles->Override($this->objItemStyle); // default style
                      }
          Severity: Minor
          Found in includes/base_controls/QCheckBoxList.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

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

                            case "RepeatColumns": return $this->intRepeatColumns;
            Severity: Major
            Found in includes/base_controls/QCheckBoxList.class.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              case "MaxHeight": return $this->strMaxHeight;
              Severity: Major
              Found in includes/base_controls/QCheckBoxList.class.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                case "RepeatDirection": return $this->strRepeatDirection;
                Severity: Major
                Found in includes/base_controls/QCheckBoxList.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/QCheckBoxList.class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    case "ButtonMode": return $this->intButtonMode;
                    Severity: Major
                    Found in includes/base_controls/QCheckBoxList.class.php - About 30 mins to fix

                      The method __set() has 121 lines of code. Current threshold is set to 100. Avoid really long methods.
                      Open

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

                      The method GetItemHtml() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
                      Open

                              protected function GetItemHtml(QListItem $objItem, $intIndex, $strTabIndex, $blnWrapLabel) {
                                  $objLabelStyles = new QTagStyler();
                                  if ($this->objItemStyle) {
                                      $objLabelStyles->Override($this->objItemStyle); // default style
                                  }

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

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

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

                              public function __get($strName) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign": return $this->strTextAlign;
                      
                      

                      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 '114', column '21').
                      Open

                                  $objStyles = new QTagStyler();

                      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 '474', column '9').
                      Open

                                      new QModelConnectorParam (get_called_class(), 'ButtonMode', 'How to display the buttons', QModelConnectorParam::SelectionList,

                      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 '479', column '9').
                      Open

                                      new QModelConnectorParam (get_called_class(), 'MaxHeight', 'If set, will wrap it in a scrollable pane with the given max height', QType::Integer)

                      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 '106', column '26').
                      Open

                                  $objLabelStyles = new QTagStyler();

                      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 '467', column '9').
                      Open

                                      new QModelConnectorParam (get_called_class(), 'HtmlEntities', 'Set to false to have the browser interpret the labels as HTML', 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

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

                                      new QModelConnectorParam (get_called_class(), 'RepeatColumns', 'The number of columns of checkboxes to display', QType::Integer),

                      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 '469', column '9').
                      Open

                                      new QModelConnectorParam (get_called_class(), 'RepeatDirection', 'Whether to repeat horizontally or vertically', QModelConnectorParam::SelectionList,

                      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 '394', column '17').
                      Open

                                              throw new QCallerException("RepeatColumns must be greater than 0");

                      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 '462', column '9').
                      Open

                                      new QModelConnectorParam (get_called_class(), 'TextAlign', '', QModelConnectorParam::SelectionList,

                      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 GetControlHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                      Open

                                  else {
                                      $strToReturn = $this->RenderButtonTable();
                                  }

                      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 using static access to class 'QHtml' in method 'RenderButtonTable'.
                      Open

                                          $strToReturn = QHtml::RenderTag('div', ['class'=>'qc-table'], $strToReturn);

                      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

                                              if ($this->strTextAlign !== ($mixValue = QType::Cast($mixValue, QType::String))) {

                      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

                                              if ($this->intRepeatColumns !== ($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 'QApplication' in method 'GetEndScript'.
                      Open

                                      QApplication::ExecuteControlCommand($ctrlId, 'buttonset', QJsPriority::High);

                      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 '363', column '38').
                      Open

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

                      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 'QHtml' in method 'RenderButtonTable'.
                      Open

                                          $strRowHtml = QHtml::RenderTag('div', ['class'=>'qc-tableRow'], $strRowHtml);

                      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 'QApplication' in method 'RefreshSelection'.
                      Open

                                  QApplication::ExecuteSelectorFunction(['input', '#' . $this->ControlId], 'val', $indexes);

                      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

                                              if ($this->blnHtmlEntities !== ($mixValue = QType::Cast($mixValue, QType::Boolean))) {

                      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 'QApplication' in method 'GetEndScript'.
                      Open

                                      QApplication::ExecuteSelectorFunction(["input:checkbox", "#" . $ctrlId], 'button', QJsPriority::High);

                      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

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

                      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 '419', column '37').
                      Open

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

                      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->strMaxHeight = QType::Cast($mixValue, QType::String);

                      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 'QApplication' in method 'RefreshSelection'.
                      Open

                                      QApplication::ExecuteSelectorFunction(['input', '#' . $this->ControlId], 'button', "refresh");

                      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 '338', column '36').
                      Open

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

                      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 'QHtml' in method 'RenderButtonColumn'.
                      Open

                                      $strToReturn .= QHtml::RenderTag('div', null, $strHtml);

                      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

                                              if ($this->intCellSpacing !== ($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 'QApplication' in method 'GetItemHtml'.
                      Open

                                      $strLabelText = QApplication::HtmlEntities($strLabelText);

                      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 RenderButtonTable uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                      Open

                                      } else {
                                          $this->AddCssClass('qc-table'); // format as a table
                                      }

                      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 using static access to class 'QApplication' in method 'Validate'.
                      Open

                                          $this->ValidationError = QApplication::Translate($this->strName) . ' ' . QApplication::Translate('is required');

                      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 'QApplication' in method 'Validate'.
                      Open

                                          $this->ValidationError = QApplication::Translate($this->strName) . ' ' . QApplication::Translate('is required');

                      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 '374', column '38').
                      Open

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

                      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 '110', column '8').
                      Open

                              protected function GetItemHtml(QListItem $objItem, $intIndex, $strTabIndex, $blnWrapLabel) {
                                  $objLabelStyles = new QTagStyler();
                                  if ($this->objItemStyle) {
                                      $objLabelStyles->Override($this->objItemStyle); // default style
                                  }

                      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

                                              if ($this->strRepeatDirection !== ($mixValue = QType::Cast($mixValue, QType::String))) {

                      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 '398', column '42').
                      Open

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

                      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

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

                                  else {
                                      $this->SetSelectedItemsByIndex($val, false);
                                  }

                      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 using static access to class 'QType' in method '__set'.
                      Open

                                              if ($this->intCellPadding !== ($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 'QHtml' in method 'GetItemHtml'.
                      Open

                                  $strHtml = QHtml::RenderLabeledInput(
                                      $strLabelText,
                                      $this->strTextAlign == QTextAlign::Left,
                                      $objStyles->RenderHtmlAttributes(),
                                      $objLabelStyles->RenderHtmlAttributes(),

                      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 '350', column '39').
                      Open

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

                      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

                                              if ($this->intButtonMode !== ($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 assigning values to variables in if clauses and the like (line '385', column '40').
                      Open

                              public function __set($strName, $mixValue) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign":
                                          try {

                      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

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

                                              else {
                                                  $this->strMaxHeight = QType::Cast($mixValue, QType::String);
                                              }

                      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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              public static function GetModelConnectorParams() {
                                  return array_merge(parent::GetModelConnectorParams(), array(
                                      new QModelConnectorParam (get_called_class(), 'TextAlign', '', QModelConnectorParam::SelectionList,
                                          array (null=>'Default',
                                              'QTextAlign::Left'=>'Left',
                      Severity: Major
                      Found in includes/base_controls/QCheckBoxList.class.php and 1 other location - About 7 hrs to fix
                      includes/base_controls/QRadioButtonList.class.php on lines 430..451

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 244.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 4 locations. Consider refactoring.
                      Open

                              public function __get($strName) {
                                  switch ($strName) {
                                      // APPEARANCE
                                      case "TextAlign": return $this->strTextAlign;
                      
                      
                      Severity: Major
                      Found in includes/base_controls/QCheckBoxList.class.php and 3 other locations - About 2 hrs to fix
                      includes/base_controls/QSliderGen.class.php on lines 364..383
                      includes/base_controls/QSpinnerGen.class.php on lines 417..436
                      includes/codegen/QReference.class.php on lines 98..126

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 124.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              public function GetEndScript() {
                                  $ctrlId = $this->ControlId;
                                  if ($this->intButtonMode == self::ButtonModeSet) {
                                      QApplication::ExecuteControlCommand($ctrlId, 'buttonset', QJsPriority::High);
                                  } elseif ($this->intButtonMode == self::ButtonModeJq) {
                      Severity: Major
                      Found in includes/base_controls/QCheckBoxList.class.php and 1 other location - About 1 hr to fix
                      includes/base_controls/QRadioButtonList.class.php on lines 81..90

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 103.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Constant ButtonModeSet should be defined in uppercase
                      Open

                              const ButtonModeSet = 2;    // a jqueryui button set

                      ConstantNamingConventions

                      Since: 0.2

                      Class/Interface constant names should always be defined in uppercase.

                      Example

                      class Foo {
                          const MY_NUM = 0; // ok
                          const myTest = ""; // fail
                      }

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

                      Constant ButtonModeJq should be defined in uppercase
                      Open

                              const ButtonModeJq = 1;        // a list of individual jquery ui buttons

                      ConstantNamingConventions

                      Since: 0.2

                      Class/Interface constant names should always be defined in uppercase.

                      Example

                      class Foo {
                          const MY_NUM = 0; // ok
                          const myTest = ""; // fail
                      }

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

                      Constant ButtonModeList should be defined in uppercase
                      Open

                              const ButtonModeList = 3;    // just a vanilla list of checkboxes with no row or column styling

                      ConstantNamingConventions

                      Since: 0.2

                      Class/Interface constant names should always be defined in uppercase.

                      Example

                      class Foo {
                          const MY_NUM = 0; // ok
                          const myTest = ""; // fail
                      }

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

                      Constant ButtonModeNone should be defined in uppercase
                      Open

                              const ButtonModeNone = 0;    // Uses the RepeatColumns and RepeateDirection settings to make a structure

                      ConstantNamingConventions

                      Since: 0.2

                      Class/Interface constant names should always be defined in uppercase.

                      Example

                      class Foo {
                          const MY_NUM = 0; // ok
                          const myTest = ""; // fail
                      }

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

                      The method GetEndScript is not named in camelCase.
                      Open

                              public function GetEndScript() {
                                  $ctrlId = $this->ControlId;
                                  if ($this->intButtonMode == self::ButtonModeSet) {
                                      QApplication::ExecuteControlCommand($ctrlId, 'buttonset', QJsPriority::High);
                                  } elseif ($this->intButtonMode == self::ButtonModeJq) {

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

                              protected function GetItemHtml(QListItem $objItem, $intIndex, $strTabIndex, $blnWrapLabel) {
                                  $objLabelStyles = new QTagStyler();
                                  if ($this->objItemStyle) {
                                      $objLabelStyles->Override($this->objItemStyle); // default style
                                  }

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

                              public function ParsePostData() {
                                  $val = $this->objForm->CheckableControlValue($this->strControlId);
                                  if (empty($val)) {
                                      $this->UnselectAllItems(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 RenderButtonSet is not named in camelCase.
                      Open

                              public function RenderButtonSet() {
                                  $count = $this->ItemCount;
                                  $strToReturn = '';
                                  for ($intIndex = 0; $intIndex < $count; $intIndex++) {
                                      $strToReturn .= $this->GetItemHtml($this->objListItemArray[$intIndex], $intIndex, $this->GetHtmlAttribute('tabindex'), $this->blnWrapLabel) . "\n";

                      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() {
                                  $indexes = $this->SelectedIndexes;
                                  QApplication::ExecuteSelectorFunction(['input', '#' . $this->ControlId], 'val', $indexes);
                                  if ($this->intButtonMode == self::ButtonModeSet ||
                                      $this->intButtonMode == self::ButtonModeJq) {

                      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 (get_called_class(), 'TextAlign', '', QModelConnectorParam::SelectionList,
                                          array (null=>'Default',
                                              'QTextAlign::Left'=>'Left',

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

                              public function Validate() {
                                  if ($this->blnRequired) {
                                      if ($this->SelectedIndex == -1) {
                                          $this->ValidationError = QApplication::Translate($this->strName) . ' ' . QApplication::Translate('is required');
                                          return 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 RenderButtonTable is not named in camelCase.
                      Open

                              public function RenderButtonTable() {
                                  $strToReturn = '';
                                  if ($this->ItemCount > 0) {
                                      // Figure out the number of ROWS for this table
                                      $intRowCount = floor($this->ItemCount / $this->intRepeatColumns);

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

                              public function RenderButtonColumn() {
                                  $count = $this->ItemCount;
                                  $strToReturn = '';
                                  for ($intIndex = 0; $intIndex < $count; $intIndex++) {
                                      $strHtml = $this->GetItemHtml($this->objListItemArray[$intIndex], $intIndex, $this->GetHtmlAttribute('tabindex'), $this->blnWrapLabel);

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

                              protected function GetControlHtml() {
                                  /* Deprecated. Use Margin and Padding on the ItemStyle attribute.
                                  if ($this->intCellPadding >= 0)
                                      $strCellPadding = sprintf('cellpadding="%s" ', $this->intCellPadding);
                                  else

                      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