qcubed/framework

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

Summary

Maintainability
D
2 days
Test Coverage

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

    public function __set($strName, $mixValue) {
        $this->blnModified = true;

        switch ($strName) {
            // BEHAVIOR
Severity: Major
Found in includes/base_controls/QPaginatorBase.class.php - About 3 hrs to fix

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

    abstract class QPaginatorBase extends QControl {
        /** @var string Label for the 'Previous' link */
        protected $strLabelForPrevious;
        /** @var string Label for the 'Next' link */
        protected $strLabelForNext;

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

        public function __set($strName, $mixValue) {
            $this->blnModified = true;
    
            switch ($strName) {
                // BEHAVIOR
    Severity: Minor
    Found in includes/base_controls/QPaginatorBase.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

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

    <?php
    
    /**
     * This controls works together with a QPaginatedControl to implement a paginator for that control. Multiple
     * paginators per QPaginatedControl can be declared.
    Severity: Minor
    Found in includes/base_controls/QPaginatorBase.class.php - About 2 hrs to fix

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

          protected function CalcBunch() {
              /**
               * "Bunch" is defined as the collection of numbers that lies in between the pair of Ellipsis ("...")
               *
               * LAYOUT
      Severity: Minor
      Found in includes/base_controls/QPaginatorBase.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

                          return ($this->strLabelForNext = QType::Cast($mixValue, QType::String));
      Severity: Major
      Found in includes/base_controls/QPaginatorBase.class.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

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

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

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

              Avoid too many return statements within this method.
              Open

                                  return $mixToReturn;
              Severity: Major
              Found in includes/base_controls/QPaginatorBase.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/QPaginatorBase.class.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

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

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

                        Avoid too many return statements within this method.
                        Open

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

                          Avoid too many return statements within this method.
                          Open

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

                            Avoid too many return statements within this method.
                            Open

                                                return ($this->strLabelForPrevious = QType::Cast($mixValue, QType::String));
                            Severity: Major
                            Found in includes/base_controls/QPaginatorBase.class.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

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

                                Avoid too many return statements within this method.
                                Open

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

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

                                      public function __set($strName, $mixValue) {
                                          $this->blnModified = true;
                                  
                                          switch ($strName) {
                                              // BEHAVIOR

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

                                      public function __get($strName) {
                                          switch ($strName) {
                                              // BEHAVIOR
                                              case "ItemsPerPage": return $this->intItemsPerPage;
                                              case "PageNumber": return $this->intPageNumber;

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

                                      public function __set($strName, $mixValue) {
                                          $this->blnModified = true;
                                  
                                          switch ($strName) {
                                              // BEHAVIOR

                                  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 '85', column '59').
                                  Open

                                              $this->prxPagination->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'Page_Click'));

                                  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 '90', column '56').
                                  Open

                                          $this->prxPagination->AddAction(new QClickEvent, new QTerminateAction());

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

                                          $this->prxPagination->AddAction(new QClickEvent, new QTerminateAction());

                                  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 '481', column '16').
                                  Open

                                                      throw new QCallerException('Paginator must have an IndexCount >= 7');

                                  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 '85', column '40').
                                  Open

                                              $this->prxPagination->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'Page_Click'));

                                  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 '88', column '40').
                                  Open

                                              $this->prxPagination->AddAction(new QClickEvent(), new QServerControlAction($this, 'Page_Click'));

                                  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 '71', column '30').
                                  Open

                                          $this->prxPagination = new QControlProxy($this);

                                  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 '88', column '59').
                                  Open

                                              $this->prxPagination->AddAction(new QClickEvent(), new QServerControlAction($this, 'Page_Click'));

                                  MissingImport

                                  Since: 2.7.0

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

                                  Example

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

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

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

                                                  $this->intIndexCount = 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->strLabelForPrevious = QApplication::Translate('Previous');

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

                                          } else {
                                              $mixActionParameter = $this->intPageNumber - 1;
                                              $strPrevious = $this->prxPagination->RenderAsLink($this->strLabelForPrevious, $mixActionParameter, ['id'=>$this->ControlId . "_arrow_" . $mixActionParameter]);
                                          }

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

                                                      else {
                                                          $this->intTotalItemCount = 0;
                                                      }

                                  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

                                                      $intNewPageNum = 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->intTotalItemCount = 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->strLabelForNext = QApplication::Translate('Next');

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

                                                  } else {
                                                      return ($this->intPageNumber = 1);
                                                  }

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

                                          $this->objPaginatedControl->PageNumber = QType::Cast($strParameter, 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

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

                                          } else {
                                              $intMinimumEndOfBunch = min($this->intIndexCount - 2, $intPageCount);
                                              $intMaximumStartOfBunch = max($intPageCount - $this->intIndexCount + 3, 1);
                                  
                                              $intLeftOfBunchCount = floor(($this->intIndexCount - 5) / 2);

                                  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

                                                          return ($this->intItemsPerPage = 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

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

                                              } else {
                                                  $this->intPageNumber = $pageCount;
                                              }

                                  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

                                                      $blnToReturn = ($this->blnUseAjax = 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 Setup uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                  Open

                                          else {
                                              $this->prxPagination->AddAction(new QClickEvent(), new QServerControlAction($this, 'Page_Click'));
                                          }

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

                                          } else {
                                              $mixActionParameter = $intIndex;
                                              $strToReturn = $this->prxPagination->RenderAsLink($intIndex, $mixActionParameter, ['id'=>$this->ControlId . "_page_" . $mixActionParameter]);
                                              $strToReturn = sprintf('<span class="page">%s</span>',$strToReturn);
                                          }

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

                                          } else {
                                              $mixActionParameter = $this->intPageNumber + 1;
                                              $strNext = $this->prxPagination->RenderAsLink($this->strLabelForNext, $mixActionParameter, ['id'=>$this->ControlId . "_arrow_" . $mixActionParameter]);
                                          }

                                  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

                                                      return ($this->strLabelForNext = 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

                                                      return ($this->strLabelForPrevious = 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

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

                                              } else {
                                                  $intPageStart = min($intMaximumStartOfBunch, $this->intPageNumber - $intLeftOfBunchCount);
                                              }

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

                                              } else {
                                                  $intPageEnd = max($intMinimumEndOfBunch, $this->intPageNumber + $intRightOfBunchCount);
                                              }

                                  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 unused local variables such as '$intPageStart'.
                                  Open

                                          list($intPageStart, $intPageEnd) = $this->CalcBunch();

                                  UnusedLocalVariable

                                  Since: 0.2

                                  Detects when a local variable is declared and/or assigned, but not used.

                                  Example

                                  class Foo {
                                      public function doSomething()
                                      {
                                          $i = 5; // Unused
                                      }
                                  }

                                  Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                                  Avoid unused parameters such as '$strFormId'.
                                  Open

                                      public function Page_Click($strFormId, $strControlId, $strParameter) {

                                  UnusedFormalParameter

                                  Since: 0.2

                                  Avoid passing parameters to methods or constructors and then not using those parameters.

                                  Example

                                  class Foo
                                  {
                                      private function bar($howdy)
                                      {
                                          // $howdy is not used
                                      }
                                  }

                                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                  Avoid unused local variables such as '$intPageEnd'.
                                  Open

                                          list($intPageStart, $intPageEnd) = $this->CalcBunch();

                                  UnusedLocalVariable

                                  Since: 0.2

                                  Detects when a local variable is declared and/or assigned, but not used.

                                  Example

                                  class Foo {
                                      public function doSomething()
                                      {
                                          $i = 5; // Unused
                                      }
                                  }

                                  Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

                                  Avoid unused parameters such as '$strControlId'.
                                  Open

                                      public function Page_Click($strFormId, $strControlId, $strParameter) {

                                  UnusedFormalParameter

                                  Since: 0.2

                                  Avoid passing parameters to methods or constructors and then not using those parameters.

                                  Example

                                  class Foo
                                  {
                                      private function bar($howdy)
                                      {
                                          // $howdy is not used
                                      }
                                  }

                                  Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

                                  Avoid excessively long variable names like $intMaximumStartOfBunch. Keep variable name length under 20.
                                  Open

                                              $intMaximumStartOfBunch = max($intPageCount - $this->intIndexCount + 3, 1);

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

                                      public function Page_Click($strFormId, $strControlId, $strParameter) {
                                          $this->objPaginatedControl->PageNumber = QType::Cast($strParameter, QType::Integer);
                                      }

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

                                      protected function GetPreviousButtonsHtml () {
                                          if ($this->intPageNumber <= 1) {
                                              $strPrevious = $this->strLabelForPrevious;
                                          } else {
                                              $mixActionParameter = $this->intPageNumber - 1;

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

                                      public function LimitPageNumber() {
                                          $pageCount = $this->CalcPageCount();
                                          if ($this->intPageNumber > $pageCount) {
                                              if ($pageCount <= 1) {
                                                  $this->intPageNumber = 1;

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

                                      protected function CalcBunch() {
                                          /**
                                           * "Bunch" is defined as the collection of numbers that lies in between the pair of Ellipsis ("...")
                                           *
                                           * LAYOUT

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

                                      public function SetPaginatedControl(QPaginatedControl $objPaginatedControl) {
                                          $this->objPaginatedControl = $objPaginatedControl;
                                  
                                          $this->UseAjax = $objPaginatedControl->UseAjax;
                                          $this->ItemsPerPage = $objPaginatedControl->ItemsPerPage;

                                  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

                                      public function GetControlHtml() {
                                          $this->objPaginatedControl->DataBind();
                                  
                                          $strToReturn = $this->GetPreviousButtonsHtml();
                                  
                                  

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

                                      protected function GetNextButtonsHtml() {
                                          list($intPageStart, $intPageEnd) = $this->CalcBunch();
                                  
                                          // build it backwards
                                  
                                  

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

                                      public function CalcPageCount() {
                                          $intCount = (int) floor($this->intTotalItemCount / $this->intItemsPerPage) +
                                              ((($this->intTotalItemCount % $this->intItemsPerPage) != 0) ? 1 : 0);
                                          return $intCount;
                                  
                                  

                                  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() {return true;}

                                  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() {}

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

                                      protected function Setup() {
                                          // Setup Pagination Events
                                          $this->prxPagination->RemoveAllActions(QClickEvent::EventName);
                                          if ($this->blnUseAjax) {
                                              $this->prxPagination->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'Page_Click'));

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

                                      protected function GetPageButtonHtml ($intIndex) {
                                          if ($this->intPageNumber == $intIndex) {
                                              $strToReturn = sprintf('<span class="selected">%s</span>', $intIndex);
                                          } else {
                                              $mixActionParameter = $intIndex;

                                  CamelCaseMethodName

                                  Since: 0.2

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

                                  Example

                                  class ClassName {
                                      public function get_name() {
                                      }
                                  }

                                  Source

                                  There are no issues that match your filters.

                                  Category
                                  Status