qcubed/framework

View on GitHub
includes/framework/QHtml.class.php

Summary

Maintainability
F
4 days
Test Coverage

Function RenderTable has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

        public static function RenderTable(array $data, $strFields = null, $attributes = null, $strHeaderTitles = null, $intHeaderColumnCount = 0, $blnHtmlEntities = true) {
            if (!$data) {
                return '';
            }

Severity: Minor
Found in includes/framework/QHtml.class.php - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

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

<?php
    /**
     * An abstract utility class to handle Html tag rendering, as well as utilities to render
     * pieces of HTML and CSS code.  All methods are static.
     */
Severity: Minor
Found in includes/framework/QHtml.class.php - About 4 hrs to fix

    Function MakeUrl has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

            public static function MakeUrl ($strLocation, $queryParams = null, $strAnchor = null, $strScheme = null, $strHost = null, $strUser = null, $strPassword = null, $intPort = null) {
                // Decompose
                if ($strLocation) {
                    $params = parse_url($strLocation);
                }
    Severity: Minor
    Found in includes/framework/QHtml.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 QHtml has 15 public methods. Consider refactoring QHtml to keep number of public methods under 10.
    Open

        abstract class QHtml {
    
            const IsVoid = true;
    
            // Common URL Protocols
    Severity: Minor
    Found in includes/framework/QHtml.class.php by phpmd

    TooManyPublicMethods

    Since: 0.1

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

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

    Example

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

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

        abstract class QHtml {
    
            const IsVoid = true;
    
            // Common URL Protocols
    Severity: Minor
    Found in includes/framework/QHtml.class.php by phpmd

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

            public static function SetLength(&$strOldLength, $newLength) {
                if ($newLength && preg_match('#^(\+|\-|/|\*)(.+)$#',$newLength, $matches)) { // do math operation
                    $strOperator = $matches[1];
                    $newValue = $matches[2];
                    assert (is_numeric($newValue));
    Severity: Minor
    Found in includes/framework/QHtml.class.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method MakeUrl has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public static function MakeUrl ($strLocation, $queryParams = null, $strAnchor = null, $strScheme = null, $strHost = null, $strUser = null, $strPassword = null, $intPort = null) {
                // Decompose
                if ($strLocation) {
                    $params = parse_url($strLocation);
                }
    Severity: Major
    Found in includes/framework/QHtml.class.php - About 2 hrs to fix

      Method RenderTable has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public static function RenderTable(array $data, $strFields = null, $attributes = null, $strHeaderTitles = null, $intHeaderColumnCount = 0, $blnHtmlEntities = true) {
                  if (!$data) {
                      return '';
                  }
      
      
      Severity: Major
      Found in includes/framework/QHtml.class.php - About 2 hrs to fix

        Method SetLength has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public static function SetLength(&$strOldLength, $newLength) {
                    if ($newLength && preg_match('#^(\+|\-|/|\*)(.+)$#',$newLength, $matches)) { // do math operation
                        $strOperator = $matches[1];
                        $newValue = $matches[2];
                        assert (is_numeric($newValue));
        Severity: Minor
        Found in includes/framework/QHtml.class.php - About 1 hr to fix

          Function FormatLength has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

                  public final static function FormatLength($strValue) {
                      if (is_numeric($strValue)) {
                          if (0 == $strValue) {
                              if (!is_int($strValue)) {
                                  $fltValue = floatval($strValue);
          Severity: Minor
          Found in includes/framework/QHtml.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 RemoveClass has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                  public static function RemoveClass(&$strClassList, $strCssNamesToRemove) {
                      $strNewCssClass = '';
                      $blnRemoved = false;
                      $strCssNamesToRemove = trim($strCssNamesToRemove);
                      if (empty($strCssNamesToRemove)) return false;
          Severity: Minor
          Found in includes/framework/QHtml.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 AddClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  public static function AddClass(&$strClassList, $strNewClasses) {
                      $strNewClasses = trim($strNewClasses);
                      if (empty($strNewClasses)) return false;
          
                      if (empty ($strClassList)) {
          Severity: Minor
          Found in includes/framework/QHtml.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

          Method MakeUrl has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  public static function MakeUrl ($strLocation, $queryParams = null, $strAnchor = null, $strScheme = null, $strHost = null, $strUser = null, $strPassword = null, $intPort = null) {
          Severity: Major
          Found in includes/framework/QHtml.class.php - About 1 hr to fix

            Method RenderTable has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    public static function RenderTable(array $data, $strFields = null, $attributes = null, $strHeaderTitles = null, $intHeaderColumnCount = 0, $blnHtmlEntities = true) {
            Severity: Minor
            Found in includes/framework/QHtml.class.php - About 45 mins to fix

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

                      public static function RenderTag($strTag, $mixAttributes, $strInnerHtml = null, $blnIsVoidElement = false, $blnNoSpace = false) {
                          assert ('!empty($strTag)');
                          $strToReturn = '<' . $strTag;
                          if ($mixAttributes) {
                              if (is_string($mixAttributes)) {
              Severity: Minor
              Found in includes/framework/QHtml.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

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

                      public static function RenderLabeledInput($strLabel, $blnTextLeft, $strAttributes, $strLabelAttributes, $blnWrapped) {
                          $strHtml = trim(self::RenderTag('input', $strAttributes, null, true));
              
                          if ($blnWrapped) {
                              if ($blnTextLeft) {
              Severity: Minor
              Found in includes/framework/QHtml.class.php - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                      public static function RenderTag($strTag, $mixAttributes, $strInnerHtml = null, $blnIsVoidElement = false, $blnNoSpace = false) {
              Severity: Minor
              Found in includes/framework/QHtml.class.php - About 35 mins to fix

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

                        public static function RenderLabeledInput($strLabel, $blnTextLeft, $strAttributes, $strLabelAttributes, $blnWrapped) {
                Severity: Minor
                Found in includes/framework/QHtml.class.php - About 35 mins to fix

                  Function RemoveClassesByPrefix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                          public static function RemoveClassesByPrefix (&$strClassList, $strPrefix) {
                              $aRet = array();
                              $blnChanged = false;
                              if ($strClassList) foreach (explode (' ', $strClassList) as $strClass) {
                                  if (strpos($strClass, $strPrefix) !== 0) {
                  Severity: Minor
                  Found in includes/framework/QHtml.class.php - About 35 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

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

                          public static function RenderHtmlAttributes ($attributes) {
                              $strToReturn = '';
                              if ($attributes) {
                                  foreach ($attributes as $strName=>$strValue) {
                                      if ($strValue === false) {
                  Severity: Minor
                  Found in includes/framework/QHtml.class.php - About 35 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

                                  return sprintf('%s', $strValue);
                  Severity: Major
                  Found in includes/framework/QHtml.class.php - About 30 mins to fix

                    The method MakeUrl() has an NPath complexity of 367416. The configured NPath complexity threshold is 200.
                    Open

                            public static function MakeUrl ($strLocation, $queryParams = null, $strAnchor = null, $strScheme = null, $strHost = null, $strUser = null, $strPassword = null, $intPort = null) {
                                // Decompose
                                if ($strLocation) {
                                    $params = parse_url($strLocation);
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    NPathComplexity

                    Since: 0.1

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

                    Example

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

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

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

                            public static function SetLength(&$strOldLength, $newLength) {
                                if ($newLength && preg_match('#^(\+|\-|/|\*)(.+)$#',$newLength, $matches)) { // do math operation
                                    $strOperator = $matches[1];
                                    $newValue = $matches[2];
                                    assert (is_numeric($newValue));
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

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

                    Example

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

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

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

                            public static function RenderTable(array $data, $strFields = null, $attributes = null, $strHeaderTitles = null, $intHeaderColumnCount = 0, $blnHtmlEntities = true) {
                                if (!$data) {
                                    return '';
                                }
                    
                    
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

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

                    Example

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

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

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

                            public static function MakeUrl ($strLocation, $queryParams = null, $strAnchor = null, $strScheme = null, $strHost = null, $strUser = null, $strPassword = null, $intPort = null) {
                                // Decompose
                                if ($strLocation) {
                                    $params = parse_url($strLocation);
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

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

                    Example

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

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

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

                            public static function Comment($strText, $blnRemoveOnMinimize = true) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    BooleanArgumentFlag

                    Since: 1.4.0

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

                    Example

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

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

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

                            public static function RenderTag($strTag, $mixAttributes, $strInnerHtml = null, $blnIsVoidElement = false, $blnNoSpace = false) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    BooleanArgumentFlag

                    Since: 1.4.0

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

                    Example

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

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

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

                            public static function RenderLink ($strUrl, $strText, $attributes = null, $blnHtmlEntities = true) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    BooleanArgumentFlag

                    Since: 1.4.0

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

                    Example

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

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

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

                            public static function RenderTable(array $data, $strFields = null, $attributes = null, $strHeaderTitles = null, $intHeaderColumnCount = 0, $blnHtmlEntities = true) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    BooleanArgumentFlag

                    Since: 1.4.0

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

                    Example

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

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

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

                            public static function RenderTag($strTag, $mixAttributes, $strInnerHtml = null, $blnIsVoidElement = false, $blnNoSpace = false) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    BooleanArgumentFlag

                    Since: 1.4.0

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

                    Example

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

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

                    Missing class import via use statement (line '32', column '14').
                    Open

                                throw new QCallerException('QHtml should never be instantiated.  All methods and variables are publicly statically accessible.');
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

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

                                    } else {
                                        $strHtml = $strHtml . $strLabel;
                                    }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    } else {
                                        $strCombined = $strHtml . $strLabel;
                                    }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

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

                                            $strHeaderTitle = QApplication::HtmlEntities($strHeaderTitle);
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    StaticAccess

                    Since: 1.4.0

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

                    Example

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

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

                    Avoid using static access to class 'QApplication' in method 'RenderTable'.
                    Open

                                                $strItem = QApplication::HtmlEntities($strItem);
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    StaticAccess

                    Since: 1.4.0

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

                    Example

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

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

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

                                } else { // no math operation
                                    $newLength = self::FormatLength($newLength);
                    
                                    if ($strOldLength !== $newLength) {
                                        $strOldLength = $newLength;
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

                    Avoid using static access to class 'QHtml' in method 'RenderTag'.
                    Open

                                        $strToReturn .=  QHtml::RenderHtmlAttributes($mixAttributes);
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    StaticAccess

                    Since: 1.4.0

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

                    Example

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

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

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

                                else {
                                    // the hardcoded newlines below are important to prevent different drawing behavior in MINIMIZE mode
                                    $strToReturn .= '>' . "\n" . _indent(trim($strInnerHtml)) .  "\n" . '</' . $strTag . '>' . _nl();
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                        } else {
                                            $oldUnits = 'px';
                                        }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    } else {
                                        return false;
                                    }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                        else {
                                            $strNewCssClass .= $strCssClass . ' ';
                                        }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    } else {
                                        $queryParams = $queryParams2;
                                    }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                } else {
                                    $strUrl = $strUser;
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                            } else {
                                                $strRow .= '<td>' . $strItem . '</td>';
                                            }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                } else {
                                    return sprintf('%s', $strValue);
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    } else {
                                        return false; // nothing changed
                                    }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                } else {
                                    $strUrl = '';
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

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

                                                $strItem = QApplication::HtmlEntities($strItem);
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    StaticAccess

                    Since: 1.4.0

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

                    Example

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

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

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

                                else {
                                    $strCurrentClasses = explode(' ', $strClassList);
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                else {
                                    $strCurrentClasses = explode(' ', $strClassList);
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                            public static function RemoveClass(&$strClassList, $strCssNamesToRemove) {
                                $strNewCssClass = '';
                                $blnRemoved = false;
                                $strCssNamesToRemove = trim($strCssNamesToRemove);
                                if (empty($strCssNamesToRemove)) return false;
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    IfStatementAssignment

                    Since: 2.7.0

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

                    Example

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

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

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

                                            } else {
                                                $strRow .= '<td>' . $strItem . '</td>';
                                            }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    } else {
                                        foreach ($row as $strItem) {
                                            $intFieldNum ++;
                                            if ($blnHtmlEntities) {
                                                $strItem = QApplication::HtmlEntities($strItem);
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                        } else {
                                            return sprintf('%s', $strValue);
                                        }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    } else {
                                        $oldValue = filter_var ($strOldLength, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
                                        if (preg_match('/([A-Z]+|[a-z]+|%)$/', $strOldLength, $matches)) {
                                            $oldUnits = $matches[1];
                                        } else {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    } else {
                                        // assume array
                                        $strToReturn .=  QHtml::RenderHtmlAttributes($mixAttributes);
                                    }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    } else {
                                        if (!is_int($strValue)) {
                                            $fltValue = floatval($strValue);
                                            return sprintf('%spx', $fltValue);
                                        } else {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

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

                                    $strText = QApplication::HtmlEntities($strText);
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    StaticAccess

                    Since: 1.4.0

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

                    Example

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

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

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

                                else {
                                    $strLabel = trim(self::RenderTag('label', $strLabelAttributes, $strLabel));
                                    if ($blnTextLeft) {
                                        $strHtml = $strLabel .  $strHtml;
                                    } else {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                        } else {
                                            return sprintf('%spx', $strValue);
                                        }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                                    else {
                                        $blnChanged = true;
                                    }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    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 variables with short names like $v. Configured minimum length is 3.
                    Open

                                    function ($v, $k) { return $k . ':' . $v; },
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

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

                    Avoid variables with short names like $k. Configured minimum length is 3.
                    Open

                                    function ($v, $k) { return $k . ':' . $v; },
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ShortVariable

                    Since: 0.2

                    Detects when a field, local, or parameter has a very short name.

                    Example

                    class Something {
                        private $q = 15; // VIOLATION - Field
                        public static function main( array $as ) { // VIOLATION - Formal
                            $r = 20 + $this->q; // VIOLATION - Local
                            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                                $r += $this->q;
                            }
                        }
                    }

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

                    Constant IsVoid should be defined in uppercase
                    Open

                            const IsVoid = true;
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    ConstantNamingConventions

                    Since: 0.2

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

                    Example

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

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

                    The method SetLength is not named in camelCase.
                    Open

                            public static function SetLength(&$strOldLength, $newLength) {
                                if ($newLength && preg_match('#^(\+|\-|/|\*)(.+)$#',$newLength, $matches)) { // do math operation
                                    $strOperator = $matches[1];
                                    $newValue = $matches[2];
                                    assert (is_numeric($newValue));
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RenderString is not named in camelCase.
                    Open

                            public static function RenderString($strText) {
                                return nl2br(htmlspecialchars($strText, ENT_COMPAT | ENT_HTML5, QApplication::$EncodingType));
                            }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RenderHtmlAttributes is not named in camelCase.
                    Open

                            public static function RenderHtmlAttributes ($attributes) {
                                $strToReturn = '';
                                if ($attributes) {
                                    foreach ($attributes as $strName=>$strValue) {
                                        if ($strValue === false) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RenderTag is not named in camelCase.
                    Open

                            public static function RenderTag($strTag, $mixAttributes, $strInnerHtml = null, $blnIsVoidElement = false, $blnNoSpace = false) {
                                assert ('!empty($strTag)');
                                $strToReturn = '<' . $strTag;
                                if ($mixAttributes) {
                                    if (is_string($mixAttributes)) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method FormatLength is not named in camelCase.
                    Open

                            public final static function FormatLength($strValue) {
                                if (is_numeric($strValue)) {
                                    if (0 == $strValue) {
                                        if (!is_int($strValue)) {
                                            $fltValue = floatval($strValue);
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RenderStyles is not named in camelCase.
                    Open

                            public static function RenderStyles($styles) {
                                if (!$styles) return '';
                                return implode('; ', array_map(
                                    function ($v, $k) { return $k . ':' . $v; },
                                    $styles,
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method Comment is not named in camelCase.
                    Open

                            public static function Comment($strText, $blnRemoveOnMinimize = true) {
                                if ($blnRemoveOnMinimize && QApplication::$Minimize) {
                                    return '';
                                }
                                return  _nl() . '<!-- ' . $strText . ' -->' . _nl();
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RenderTable is not named in camelCase.
                    Open

                            public static function RenderTable(array $data, $strFields = null, $attributes = null, $strHeaderTitles = null, $intHeaderColumnCount = 0, $blnHtmlEntities = true) {
                                if (!$data) {
                                    return '';
                                }
                    
                    
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method AddClass is not named in camelCase.
                    Open

                            public static function AddClass(&$strClassList, $strNewClasses) {
                                $strNewClasses = trim($strNewClasses);
                                if (empty($strNewClasses)) return false;
                    
                                if (empty ($strClassList)) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method MakeUrl is not named in camelCase.
                    Open

                            public static function MakeUrl ($strLocation, $queryParams = null, $strAnchor = null, $strScheme = null, $strHost = null, $strUser = null, $strPassword = null, $intPort = null) {
                                // Decompose
                                if ($strLocation) {
                                    $params = parse_url($strLocation);
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RemoveClassesByPrefix is not named in camelCase.
                    Open

                            public static function RemoveClassesByPrefix (&$strClassList, $strPrefix) {
                                $aRet = array();
                                $blnChanged = false;
                                if ($strClassList) foreach (explode (' ', $strClassList) as $strClass) {
                                    if (strpos($strClass, $strPrefix) !== 0) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RenderLabeledInput is not named in camelCase.
                    Open

                            public static function RenderLabeledInput($strLabel, $blnTextLeft, $strAttributes, $strLabelAttributes, $blnWrapped) {
                                $strHtml = trim(self::RenderTag('input', $strAttributes, null, true));
                    
                                if ($blnWrapped) {
                                    if ($blnTextLeft) {
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RemoveClass is not named in camelCase.
                    Open

                            public static function RemoveClass(&$strClassList, $strCssNamesToRemove) {
                                $strNewCssClass = '';
                                $blnRemoved = false;
                                $strCssNamesToRemove = trim($strCssNamesToRemove);
                                if (empty($strCssNamesToRemove)) return false;
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method MailToUrl is not named in camelCase.
                    Open

                            public static function MailToUrl ($strUser, $strServer = null, $queryParams = null, $strName = null) {
                                if ($strServer) {
                                    $strUrl = $strUser . '@' . $strServer;
                                } else {
                                    $strUrl = $strUser;
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method RenderLink is not named in camelCase.
                    Open

                            public static function RenderLink ($strUrl, $strText, $attributes = null, $blnHtmlEntities = true) {
                                $attributes["href"] = $strUrl;
                                if ($blnHtmlEntities) {
                                    $strText = QApplication::HtmlEntities($strText);
                                }
                    Severity: Minor
                    Found in includes/framework/QHtml.class.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    There are no issues that match your filters.

                    Category
                    Status