XoopsModules25x/apcal

View on GitHub
include/oninstall.php

Summary

Maintainability
F
3 days
Test Coverage

transferTable accesses the super-global variable $GLOBALS.
Open

function transferTable($tablename)
{
    $errors = '';
    $result = $GLOBALS['xoopsDB']->queryF("SELECT * FROM {$GLOBALS['xoopsDB']->prefix('pical_'.$tablename)}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

transferTable accesses the super-global variable $GLOBALS.
Open

function transferTable($tablename)
{
    $errors = '';
    $result = $GLOBALS['xoopsDB']->queryF("SELECT * FROM {$GLOBALS['xoopsDB']->prefix('pical_'.$tablename)}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

transferTable accesses the super-global variable $GLOBALS.
Open

function transferTable($tablename)
{
    $errors = '';
    $result = $GLOBALS['xoopsDB']->queryF("SELECT * FROM {$GLOBALS['xoopsDB']->prefix('pical_'.$tablename)}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortCatAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortCatAftertransfer()
{

    $result = $GLOBALS['xoopsDB']->queryF("SELECT cid, cat_title FROM {$GLOBALS['xoopsDB']->prefix('apcal_cat')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_install_apcal(XoopsModule $xoopsModule)
{
    require_once  __DIR__ . '/../../../mainfile.php';
    require_once  __DIR__ . '/../include/config.php';

Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortEventAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortEventAftertransfer()
{
    $result = $GLOBALS['xoopsDB']->queryF("SELECT id, summary FROM {$GLOBALS['xoopsDB']->prefix('apcal_event')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
        $shortsummary = makeShort($row['summary']);
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

transferTable accesses the super-global variable $GLOBALS.
Open

function transferTable($tablename)
{
    $errors = '';
    $result = $GLOBALS['xoopsDB']->queryF("SELECT * FROM {$GLOBALS['xoopsDB']->prefix('pical_'.$tablename)}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_install_apcal(XoopsModule $xoopsModule)
{
    require_once  __DIR__ . '/../../../mainfile.php';
    require_once  __DIR__ . '/../include/config.php';

Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortCatAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortCatAftertransfer()
{

    $result = $GLOBALS['xoopsDB']->queryF("SELECT cid, cat_title FROM {$GLOBALS['xoopsDB']->prefix('apcal_cat')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortCatAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortCatAftertransfer()
{

    $result = $GLOBALS['xoopsDB']->queryF("SELECT cid, cat_title FROM {$GLOBALS['xoopsDB']->prefix('apcal_cat')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortEventAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortEventAftertransfer()
{
    $result = $GLOBALS['xoopsDB']->queryF("SELECT id, summary FROM {$GLOBALS['xoopsDB']->prefix('apcal_event')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
        $shortsummary = makeShort($row['summary']);
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_install_apcal(XoopsModule $xoopsModule)
{
    require_once  __DIR__ . '/../../../mainfile.php';
    require_once  __DIR__ . '/../include/config.php';

Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_install_apcal(XoopsModule $xoopsModule)
{
    require_once  __DIR__ . '/../../../mainfile.php';
    require_once  __DIR__ . '/../include/config.php';

Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortEventAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortEventAftertransfer()
{
    $result = $GLOBALS['xoopsDB']->queryF("SELECT id, summary FROM {$GLOBALS['xoopsDB']->prefix('apcal_event')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
        $shortsummary = makeShort($row['summary']);
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortCatAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortCatAftertransfer()
{

    $result = $GLOBALS['xoopsDB']->queryF("SELECT cid, cat_title FROM {$GLOBALS['xoopsDB']->prefix('apcal_cat')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_install_apcal(XoopsModule $xoopsModule)
{
    require_once  __DIR__ . '/../../../mainfile.php';
    require_once  __DIR__ . '/../include/config.php';

Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_install_apcal(XoopsModule $xoopsModule)
{
    require_once  __DIR__ . '/../../../mainfile.php';
    require_once  __DIR__ . '/../include/config.php';

Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortEventAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortEventAftertransfer()
{
    $result = $GLOBALS['xoopsDB']->queryF("SELECT id, summary FROM {$GLOBALS['xoopsDB']->prefix('apcal_event')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
        $shortsummary = makeShort($row['summary']);
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortCatAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortCatAftertransfer()
{

    $result = $GLOBALS['xoopsDB']->queryF("SELECT cid, cat_title FROM {$GLOBALS['xoopsDB']->prefix('apcal_cat')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

transferTable accesses the super-global variable $GLOBALS.
Open

function transferTable($tablename)
{
    $errors = '';
    $result = $GLOBALS['xoopsDB']->queryF("SELECT * FROM {$GLOBALS['xoopsDB']->prefix('pical_'.$tablename)}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_pre_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_pre_install_apcal(XoopsModule $module)
{
    $moduleDirName = basename(dirname(__DIR__));
    $classUtility     = ucfirst($moduleDirName) . 'Utility';
    if (!class_exists($classUtility)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_pre_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_pre_install_apcal(XoopsModule $module)
{
    $moduleDirName = basename(dirname(__DIR__));
    $classUtility     = ucfirst($moduleDirName) . 'Utility';
    if (!class_exists($classUtility)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

xoops_module_install_apcal accesses the super-global variable $GLOBALS.
Open

function xoops_module_install_apcal(XoopsModule $xoopsModule)
{
    require_once  __DIR__ . '/../../../mainfile.php';
    require_once  __DIR__ . '/../include/config.php';

Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

makeShortEventAftertransfer accesses the super-global variable $GLOBALS.
Open

function makeShortEventAftertransfer()
{
    $result = $GLOBALS['xoopsDB']->queryF("SELECT id, summary FROM {$GLOBALS['xoopsDB']->prefix('apcal_event')}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
        $shortsummary = makeShort($row['summary']);
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

transferTable accesses the super-global variable $GLOBALS.
Open

function transferTable($tablename)
{
    $errors = '';
    $result = $GLOBALS['xoopsDB']->queryF("SELECT * FROM {$GLOBALS['xoopsDB']->prefix('pical_'.$tablename)}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

transferTable accesses the super-global variable $GLOBALS.
Open

function transferTable($tablename)
{
    $errors = '';
    $result = $GLOBALS['xoopsDB']->queryF("SELECT * FROM {$GLOBALS['xoopsDB']->prefix('pical_'.$tablename)}");
    while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
Severity: Minor
Found in include/oninstall.php by phpmd

Superglobals

Since: 0.2

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

Example

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

Source

Method makeShort has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function makeShort($str)
{
    $replacements = array(
        'Š' => 'S',
        'š' => 's',
Severity: Major
Found in include/oninstall.php - About 2 hrs to fix

    Method xoops_module_install_apcal has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function xoops_module_install_apcal(XoopsModule $xoopsModule)
    {
        require_once  __DIR__ . '/../../../mainfile.php';
        require_once  __DIR__ . '/../include/config.php';
    
    
    Severity: Minor
    Found in include/oninstall.php - About 1 hr to fix

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

      function xoops_module_install_apcal(XoopsModule $xoopsModule)
      {
          require_once  __DIR__ . '/../../../mainfile.php';
          require_once  __DIR__ . '/../include/config.php';
      
      
      Severity: Minor
      Found in include/oninstall.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 transferTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function transferTable($tablename)
      {
          $errors = '';
          $result = $GLOBALS['xoopsDB']->queryF("SELECT * FROM {$GLOBALS['xoopsDB']->prefix('pical_'.$tablename)}");
          while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
      Severity: Minor
      Found in include/oninstall.php - About 55 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

      The function xoops_module_install_apcal() has an NPath complexity of 576. The configured NPath complexity threshold is 200.
      Open

      function xoops_module_install_apcal(XoopsModule $xoopsModule)
      {
          require_once  __DIR__ . '/../../../mainfile.php';
          require_once  __DIR__ . '/../include/config.php';
      
      
      Severity: Minor
      Found in include/oninstall.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 function xoops_module_install_apcal() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
      Open

      function xoops_module_install_apcal(XoopsModule $xoopsModule)
      {
          require_once  __DIR__ . '/../../../mainfile.php';
          require_once  __DIR__ . '/../include/config.php';
      
      
      Severity: Minor
      Found in include/oninstall.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

      Missing class import via use statement (line '186', column '51').
      Open

          $pical_cat    = $gpermHandler->getObjects(new Criteria('gperm_name', 'pical_cat'));
      Severity: Minor
      Found in include/oninstall.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

      Missing class import via use statement (line '72', column '25').
      Open

          $configurator = new ModuleConfigurator();
      Severity: Minor
      Found in include/oninstall.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

      Missing class import via use statement (line '187', column '51').
      Open

          $pical_global = $gpermHandler->getObjects(new Criteria('gperm_name', 'pical_global'));
      Severity: Minor
      Found in include/oninstall.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

      Duplicated array key ý, first declared at line 289.
      Open

          $replacements = array(
              'Š' => 'S',
              'š' => 's',
              'Ž' => 'Z',
              'ž' => 'z',
      Severity: Minor
      Found in include/oninstall.php by phpmd

      DuplicatedArrayKey

      Defining another value for the same key in an array literal overrides the previous key/value, which makes it effectively an unused code. If it's known from the beginning that the key will have different value, there is usually no point in defining first one.

      Example

      function createArray() {
          return [
              'non-associative 0element', // not applied
              0 => 'associative 0-element', // applied
              false => 'associative 0-element', // applied
              'foo' => 'bar', // not applied
              "foo" => 'baz', // applied
          ];
      }

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

      Avoid using static access to class 'Xmf\Module\Helper' in method 'xoops_module_install_apcal'.
      Open

              $moduleHelper = Xmf\Module\Helper::getHelper('system');
      Severity: Minor
      Found in include/oninstall.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 assigning values to variables in if clauses and the like (line '63', column '20').
      Open

      function xoops_module_install_apcal(XoopsModule $xoopsModule)
      {
          require_once  __DIR__ . '/../../../mainfile.php';
          require_once  __DIR__ . '/../include/config.php';
      
      
      Severity: Minor
      Found in include/oninstall.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 xoops_module_install_apcal uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

          } else {
              $moduleHelper = Xmf\Module\Helper::getHelper('system');
          }
      Severity: Minor
      Found in include/oninstall.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 'Xmf\Module\Helper' in method 'xoops_module_install_apcal'.
      Open

          if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
      Severity: Minor
      Found in include/oninstall.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

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

      function makeShort($str)
      {
          $replacements = array(
              'Š' => 'S',
              'š' => 's',
      Severity: Major
      Found in include/oninstall.php and 1 other location - About 2 days to fix
      include/onupdate.php on lines 271..345

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 431.

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

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

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

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

      Refactorings

      Further Reading

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

      function makeShortEventAftertransfer()
      {
          $result = $GLOBALS['xoopsDB']->queryF("SELECT id, summary FROM {$GLOBALS['xoopsDB']->prefix('apcal_event')}");
          while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
              $shortsummary = makeShort($row['summary']);
      Severity: Major
      Found in include/oninstall.php and 1 other location - About 1 hr to fix
      include/oninstall.php on lines 140..148

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 104.

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

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

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

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

      Refactorings

      Further Reading

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

      function makeShortCatAftertransfer()
      {
      
          $result = $GLOBALS['xoopsDB']->queryF("SELECT cid, cat_title FROM {$GLOBALS['xoopsDB']->prefix('apcal_cat')}");
          while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
      Severity: Major
      Found in include/oninstall.php and 1 other location - About 1 hr to fix
      include/oninstall.php on lines 131..138

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 104.

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

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

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

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

      Refactorings

      Further Reading

      Line exceeds 120 characters; contains 121 characters
      Open

          $GLOBALS['xoopsDB']->queryF("UPDATE {$GLOBALS['xoopsDB']->prefix('apcal_event')} SET start_date=NULL,end_date=NULL");
      Severity: Minor
      Found in include/oninstall.php by phpcodesniffer

      Line exceeds 120 characters; contains 152 characters
      Open

              $GLOBALS['xoopsDB']->queryF("UPDATE {$GLOBALS['xoopsDB']->prefix('apcal_cat')} SET cat_shorttitle='{$cat_shorttitle}' WHERE cid={$row['cid']}");
      Severity: Minor
      Found in include/oninstall.php by phpcodesniffer

      Line exceeds 120 characters; contains 170 characters
      Open

          $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'";
      Severity: Minor
      Found in include/oninstall.php by phpcodesniffer

      Line exceeds 120 characters; contains 137 characters
      Open

              if (!$GLOBALS['xoopsDB']->queryF("INSERT INTO {$GLOBALS['xoopsDB']->prefix('apcal_'.$tablename)}($fields) VALUES ({$values})")) {
      Severity: Minor
      Found in include/oninstall.php by phpcodesniffer

      Line exceeds 120 characters; contains 148 characters
      Open

              $GLOBALS['xoopsDB']->queryF("UPDATE {$GLOBALS['xoopsDB']->prefix('apcal_event')} SET shortsummary='{$shortsummary}' WHERE id={$row['id']}");
      Severity: Minor
      Found in include/oninstall.php by phpcodesniffer

      Line exceeds 120 characters; contains 290 characters
      Open

          $GLOBALS['xoopsDB']->queryF("UPDATE {$GLOBALS['xoopsDB']->prefix('apcal_event')} t, (SELECT id, shortsummary FROM {$GLOBALS['xoopsDB']->prefix('apcal_event')} x WHERE x.rrule_pid>0 GROUP BY x.shortsummary ORDER BY start) AS e SET t.rrule_pid=e.id WHERE t.shortsummary=e.shortsummary;");
      Severity: Minor
      Found in include/oninstall.php by phpcodesniffer

      The variable $cat_perm is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $cat_perm is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $pical_cat is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $cat_perm is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $global_perm is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $pical_global is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $global_perm is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $mod_tables is not named in camelCase.
      Open

      function xoops_module_pre_install_apcal(XoopsModule $module)
      {
          $moduleDirName = basename(dirname(__DIR__));
          $classUtility     = ucfirst($moduleDirName) . 'Utility';
          if (!class_exists($classUtility)) {
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $cat_shorttitle is not named in camelCase.
      Open

      function makeShortCatAftertransfer()
      {
      
          $result = $GLOBALS['xoopsDB']->queryF("SELECT cid, cat_title FROM {$GLOBALS['xoopsDB']->prefix('apcal_cat')}");
          while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $pical_global is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $global_perm is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $pical_cat is not named in camelCase.
      Open

      function setDefaultPerm()
      {
          $moduleHnd     = xoops_getHandler('module');
          $module        = $moduleHnd->getByDirname('APCal');
          $modid         = $module->getVar('mid');
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $mod_tables is not named in camelCase.
      Open

      function xoops_module_pre_install_apcal(XoopsModule $module)
      {
          $moduleDirName = basename(dirname(__DIR__));
          $classUtility     = ucfirst($moduleDirName) . 'Utility';
          if (!class_exists($classUtility)) {
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $cat_shorttitle is not named in camelCase.
      Open

      function makeShortCatAftertransfer()
      {
      
          $result = $GLOBALS['xoopsDB']->queryF("SELECT cid, cat_title FROM {$GLOBALS['xoopsDB']->prefix('apcal_cat')}");
          while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
      Severity: Minor
      Found in include/oninstall.php by phpmd

      CamelCaseVariableName

      Since: 0.2

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

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      There are no issues that match your filters.

      Category
      Status