qcubed/framework

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

Summary

Maintainability
F
6 days
Test Coverage

ParsePostData accesses the super-global variable $_POST.
Open

        public function ParsePostData() {
            // Check to see if this Control's Value was passed in via the POST data
            if (array_key_exists($this->strControlId, $_POST)) {
                // It was -- update this Control's value with the new value passed in via the POST arguments
                $strText = $_POST[$this->strControlId];

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

ParsePostData accesses the super-global variable $_POST.
Open

        public function ParsePostData() {
            // Check to see if this Control's Value was passed in via the POST data
            if (array_key_exists($this->strControlId, $_POST)) {
                // It was -- update this Control's value with the new value passed in via the POST arguments
                $strText = $_POST[$this->strControlId];

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

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

        public function __set($strName, $mixValue) {
            // Setters that do not cause a complete redraw
            switch ($strName) {
                case "Text":
                case "Value":
Severity: Minor
Found in includes/base_controls/QTextBoxBase.class.php - About 1 day 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 208 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function __set($strName, $mixValue) {
            // Setters that do not cause a complete redraw
            switch ($strName) {
                case "Text":
                case "Value":
Severity: Major
Found in includes/base_controls/QTextBoxBase.class.php - About 1 day to fix

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

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

      Consider simplifying this complex logical expression.
      Open

                              if ((mb_strpos($strText, '<script', 0, QApplication::$EncodingType) !== false) ||
                                  (mb_strpos($strText, '<applet', 0, QApplication::$EncodingType) !== false) ||
                                  (mb_strpos($strText, '<embed', 0, QApplication::$EncodingType) !== false) ||
                                  (mb_strpos($strText, '<style', 0, QApplication::$EncodingType) !== false) ||
                                  (mb_strpos($strText, '<link', 0, QApplication::$EncodingType) !== false) ||
      Severity: Critical
      Found in includes/base_controls/QTextBoxBase.class.php - About 5 hrs to fix

        Function Validate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

                public function Validate() {
                    // Copy text
                    $strText = $this->strText;
                    // Check for Required
                    if ($this->blnRequired) {
        Severity: Minor
        Found in includes/base_controls/QTextBoxBase.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

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

            abstract class QTextBoxBase extends QControl {
                // APPEARANCE
                /** @var int */
                protected $intColumns = 0;
                /** @var string */

        Method ParsePostData has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function ParsePostData() {
                    // Check to see if this Control's Value was passed in via the POST data
                    if (array_key_exists($this->strControlId, $_POST)) {
                        // It was -- update this Control's value with the new value passed in via the POST arguments
                        $strText = $_POST[$this->strControlId];
        Severity: Minor
        Found in includes/base_controls/QTextBoxBase.class.php - About 1 hr to fix

          The class QTextBoxBase has 22 fields. Consider redesigning QTextBoxBase to keep the number of fields under 15.
          Open

              abstract class QTextBoxBase extends QControl {
                  // APPEARANCE
                  /** @var int */
                  protected $intColumns = 0;
                  /** @var string */

          TooManyFields

          Since: 0.1

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

          Example

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

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

          Method Validate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function Validate() {
                      // Copy text
                      $strText = $this->strText;
                      // Check for Required
                      if ($this->blnRequired) {
          Severity: Minor
          Found in includes/base_controls/QTextBoxBase.class.php - About 1 hr to fix

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

                    public function __get($strName) {
                        switch ($strName) {
                            // APPEARANCE
                            case "Columns": return $this->intColumns;
                            case "Format": return $this->strFormat;
            Severity: Minor
            Found in includes/base_controls/QTextBoxBase.class.php - About 1 hr to fix

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

                      public function RenderHtmlAttributes ($attributeOverrides = null, $styleOverrides = null) {
                          if ($this->intMaxLength) {
                              $attributeOverrides['maxlength'] = $this->intMaxLength;
                          }
                          if ($this->strTextMode == QTextMode::MultiLine) {
              Severity: Minor
              Found in includes/base_controls/QTextBoxBase.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 ParsePostData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function ParsePostData() {
                          // Check to see if this Control's Value was passed in via the POST data
                          if (array_key_exists($this->strControlId, $_POST)) {
                              // It was -- update this Control's value with the new value passed in via the POST arguments
                              $strText = $_POST[$this->strControlId];
              Severity: Minor
              Found in includes/base_controls/QTextBoxBase.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 "ValidateFilterOptions": return $this->mixValidateFilterOptions;
              Severity: Major
              Found in includes/base_controls/QTextBoxBase.class.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

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

                  Avoid too many return statements within this method.
                  Open

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

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

                        Avoid too many return statements within this method.
                        Open

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

                          Avoid too many return statements within this method.
                          Open

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

                            Avoid too many return statements within this method.
                            Open

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

                              Avoid too many return statements within this method.
                              Open

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

                                Avoid too many return statements within this method.
                                Open

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

                                  Avoid too many return statements within this method.
                                  Open

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

                                    Avoid too many return statements within this method.
                                    Open

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

                                      Avoid too many return statements within this method.
                                      Open

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

                                        Avoid too many return statements within this method.
                                        Open

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

                                          Avoid too many return statements within this method.
                                          Open

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

                                            Avoid too many return statements within this method.
                                            Open

                                                            case 'Value': return empty($this->strText) ? null : $this->strText;
                                            Severity: Major
                                            Found in includes/base_controls/QTextBoxBase.class.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

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

                                                Avoid too many return statements within this method.
                                                Open

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

                                                    Avoid too many return statements within this method.
                                                    Open

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

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

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

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

                                                              public function Validate() {
                                                                  // Copy text
                                                                  $strText = $this->strText;
                                                                  // Check for Required
                                                                  if ($this->blnRequired) {

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

                                                              public function Validate() {
                                                                  // Copy text
                                                                  $strText = $this->strText;
                                                                  // Check for Required
                                                                  if ($this->blnRequired) {

                                                      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 54. The configured cyclomatic complexity threshold is 10.
                                                      Open

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

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

                                                              public function ParsePostData() {
                                                                  // Check to see if this Control's Value was passed in via the POST data
                                                                  if (array_key_exists($this->strControlId, $_POST)) {
                                                                      // It was -- update this Control's value with the new value passed in via the POST arguments
                                                                      $strText = $_POST[$this->strControlId];

                                                      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 25. The configured cyclomatic complexity threshold is 10.
                                                      Open

                                                              public function __get($strName) {
                                                                  switch ($strName) {
                                                                      // APPEARANCE
                                                                      case "Columns": return $this->intColumns;
                                                                      case "Format": return $this->strFormat;

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

                                                                      new QModelConnectorParam (get_called_class(), 'Placeholder', 'HTML5 Placeholder attribute', QType::String),

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

                                                                      new QModelConnectorParam (get_called_class(), 'TextMode', 'Field type', 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 '701', column '9').
                                                      Open

                                                                      new QModelConnectorParam (get_called_class(), 'ReadOnly', 'Editable or not', 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 '697', column '9').
                                                      Open

                                                                      new QModelConnectorParam (get_called_class(), 'Columns', 'Width of field', 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 '698', column '9').
                                                      Open

                                                                      new QModelConnectorParam (get_called_class(), 'Rows', 'Height of field for multirow field', 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 '699', column '9').
                                                      Open

                                                                      new QModelConnectorParam (get_called_class(), 'Format', 'printf format string to use', QType::String),

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

                                                                              $objPurifier = new HTMLPurifier($this->objHTMLPurifierConfig);

                                                      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 '221', column '18').
                                                      Open

                                                                                  throw new QCrossScriptingException($this->strControlId);

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

                                                                  } else {
                                                                      if ($this->intColumns) {
                                                                          $attributeOverrides['size'] = $this->intColumns;
                                                                      }
                                                                      $typeStr = $this->strTextMode ? $this->strTextMode : 'text';

                                                      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->intMaxLength !== ($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 '__construct'.
                                                      Open

                                                                  $this->strLabelForTooShort = QApplication::Translate('%s must have at least %s characters');

                                                      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->strLabelForInvalid = 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 'Select'.
                                                      Open

                                                                  QApplication::ExecuteJavaScript(sprintf('qc.getW("%s").select();', $this->strControlId));

                                                      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->strLabelForTooShort = 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->strPlaceholder !== ($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 'QApplication' in method '__construct'.
                                                      Open

                                                                  $this->strLabelForRequired = QApplication::Translate('%s 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 '__construct'.
                                                      Open

                                                                  $this->strLabelForTooLong = QApplication::Translate('%s must have at most %s characters');

                                                      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 'HTMLPurifier_Config' in method 'InitHtmlPurifier'.
                                                      Open

                                                                  $this->objHTMLPurifierConfig = HTMLPurifier_Config::createDefault();

                                                      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 '__construct'.
                                                      Open

                                                                  $this->strLabelForTooLongUnnamed = QApplication::Translate('Must have at most %s characters');

                                                      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 '597', column '31').
                                                      Open

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

                                                      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->intColumns !== ($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

                                                                              $this->strLabelForTooShortUnnamed = 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

                                                                              $this->strLabelForTooLong = 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 '__construct'.
                                                      Open

                                                                  $this->strLabelForRequiredUnnamed = QApplication::Translate('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 'QType' in method '__set'.
                                                      Open

                                                                              $this->blnAutoTrim = 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

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

                                                                  } else {
                                                                      # Disable the cache entirely
                                                                      $this->objHTMLPurifierConfig->set('Cache.DefinitionImpl', null);
                                                                  }

                                                      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 'GetControlHtml'.
                                                      Open

                                                                          $strText = QApplication::HtmlEntities($this->strText);

                                                      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->strLabelForRequired = 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

                                                                              $this->strCrossScripting = 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

                                                                              $this->intSanitizeFilter = 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 '550', column '38').
                                                      Open

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

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

                                                                              $this->strText = QApplication::HtmlEntities($this->strText);

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

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

                                                      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->strLabelForTooLongUnnamed = 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->strTextMode !== ($strMode = 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 '575', column '36').
                                                      Open

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

                                                      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->strLabelForRequiredUnnamed = 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

                                                                              $this->intValidateFilter = 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 '__construct'.
                                                      Open

                                                                  $this->strLabelForTooShortUnnamed = QApplication::Translate('Must have at least %s characters');

                                                      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 '490', column '33').
                                                      Open

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

                                                      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 '608', column '35').
                                                      Open

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

                                                      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->strFormat !== ($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 '586', column '36').
                                                      Open

                                                              public function __set($strName, $mixValue) {
                                                                  // Setters that do not cause a complete redraw
                                                                  switch ($strName) {
                                                                      case "Text":
                                                                      case "Value":

                                                      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

                                                                              $val = 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->intMinLength !== ($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

                                                                              if ($this->intRows !== ($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 excessively long variable names like $strLabelForRequiredUnnamed. Keep variable name length under 20.
                                                      Open

                                                              protected $strLabelForRequiredUnnamed;

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

                                                              protected $strLabelForTooShortUnnamed;

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

                                                              protected $strLabelForTooLongUnnamed;

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

                                                              protected $mixValidateFilterOptions = 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 $objHTMLPurifierConfig. Keep variable name length under 20.
                                                      Open

                                                              protected $objHTMLPurifierConfig = 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 $mixSanitizeFilterOptions. Keep variable name length under 20.
                                                      Open

                                                              protected $mixSanitizeFilterOptions = 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 InitHtmlPurifier is not named in camelCase.
                                                      Open

                                                              protected function InitHtmlPurifier() {
                                                                  // If we are purifying using HTMLPurify, we will need the autoloader to be included.
                                                                  // We load lazy to make sure that the library is not loaded every time 'prepend.inc.php'
                                                                  // or 'qcubed.inc.php' is inlcuded. HTMLPurifier is a HUGE and SLOW library. Lazy loading
                                                                  // keeps it simpler.

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

                                                              protected function Sanitize() {
                                                                  if ($this->blnAutoTrim) {
                                                                      $this->strText = trim ($this->strText);
                                                                  }
                                                                  

                                                      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(), 'Columns', 'Width of field', QType::Integer),
                                                                      new QModelConnectorParam (get_called_class(), 'Rows', 'Height of field for multirow field', QType::Integer),
                                                                      new QModelConnectorParam (get_called_class(), 'Format', 'printf format string to use', QType::String),

                                                      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() {
                                                                  // Check to see if this Control's Value was passed in via the POST data
                                                                  if (array_key_exists($this->strControlId, $_POST)) {
                                                                      // It was -- update this Control's value with the new value passed in via the POST arguments
                                                                      $strText = $_POST[$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 GetControlHtml is not named in camelCase.
                                                      Open

                                                              protected function GetControlHtml() {
                                                                  $attrOverride = array('name'=>$this->strControlId);
                                                      
                                                                  switch ($this->strTextMode) {
                                                                      case QTextMode::MultiLine:

                                                      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

                                                              protected function PutState($state) {
                                                                  if (isset($state['text'])) {
                                                                      $this->Text = $state['text'];
                                                                  }
                                                              }

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

                                                              public function SetPurifierConfig($strParameter, $mixValue) {
                                                                  if ($this->objHTMLPurifierConfig != null) {
                                                                      $this->objHTMLPurifierConfig->set($strParameter, $mixValue);
                                                                  }
                                                              }

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

                                                              public function Select() {
                                                                  QApplication::ExecuteJavaScript(sprintf('qc.getW("%s").select();', $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 GetState is not named in camelCase.
                                                      Open

                                                              protected function GetState(){
                                                                  return array('text'=>$this->Text);
                                                              }

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

                                                              public function RenderHtmlAttributes ($attributeOverrides = null, $styleOverrides = null) {
                                                                  if ($this->intMaxLength) {
                                                                      $attributeOverrides['maxlength'] = $this->intMaxLength;
                                                                  }
                                                                  if ($this->strTextMode == QTextMode::MultiLine) {

                                                      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() {
                                                                  // Copy text
                                                                  $strText = $this->strText;
                                                                  // Check for Required
                                                                  if ($this->blnRequired) {

                                                      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