XoopsModules25x/xoopstube

View on GitHub
admin/altcat.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method makeTreeCheckTable has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function makeTreeCheckTable(Xoopstube\Tree $xt, $itemid, $title, $checks, $order = '')
{
    global $myts;

    echo '<div style="text-align: left;">';
Severity: Minor
Found in admin/altcat.php - About 1 hr to fix

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

    function makeTreeCheckTable(Xoopstube\Tree $xt, $itemid, $title, $checks, $order = '')
    Severity: Minor
    Found in admin/altcat.php - About 35 mins to fix

      Avoid using static access to class '\Xmf\Request' in method 'makeTreeCheckTable'.
      Open

                  $disabled      = ($cat['cid'] === Request::getInt('cid', 0, 'GET')) ? "disabled='yes'" : '';
      Severity: Minor
      Found in admin/altcat.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 '\Xmf\Request' in method 'makeTreeCheckTable'.
      Open

              $disabled = ($cid === Request::getInt('cid', 0, 'GET')) ? "disabled='yes'" : '';
      Severity: Minor
      Found in admin/altcat.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 unused local variables such as '$level'.
      Open

              $level    = 1;
      Severity: Minor
      Found in admin/altcat.php by phpmd

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

          global $myts;
      Severity: Minor
      Found in admin/altcat.php by phpmd

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

      function makeTreeCheckTable(Xoopstube\Tree $xt, $itemid, $title, $checks, $order = '')
      Severity: Minor
      Found in admin/altcat.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

      A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 35 and the first side effect is on line 23.
      Open

      <?php
      Severity: Minor
      Found in admin/altcat.php by phpcodesniffer

      Line exceeds 120 characters; contains 144 characters
      Open

                      $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') . '(cid, lid) VALUES("' . $cid[1] . '","' . $lid . '")';
      Severity: Minor
      Found in admin/altcat.php by phpcodesniffer

      Line exceeds 120 characters; contains 123 characters
      Open

                  $catpath       = '&nbsp;' . $cat['prefix'] . '&nbsp;' . htmlspecialchars($cat[$title], ENT_QUOTES | ENT_HTML5);
      Severity: Minor
      Found in admin/altcat.php by phpcodesniffer

      Line exceeds 120 characters; contains 125 characters
      Open

          $sql = 'SELECT ' . $xt->id . ', ' . $title . ' FROM ' . $xt->table . ' WHERE ' . $xt->pid . '=0' . ' ORDER BY ' . $title;
      Severity: Minor
      Found in admin/altcat.php by phpcodesniffer

      Line exceeds 120 characters; contains 167 characters
      Open

                  //          echo "<tr><td>" . $catpath . "<input type='checkbox' name='cid-" . $cat['cid'] . "' value='0' " . $checked . " " . $disabled . "></td></tr>\n";
      Severity: Minor
      Found in admin/altcat.php by phpcodesniffer

      Line exceeds 120 characters; contains 159 characters
      Open

              $sql     = $GLOBALS['xoopsDB']->query('SELECT cid FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_altcat') . ' WHERE lid="' . $lid . '" ORDER BY lid');
      Severity: Minor
      Found in admin/altcat.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status