XoopsModules25x/apcal

View on GitHub
include/waiting.plugin.php

Summary

Maintainability
A
0 mins
Test Coverage

b_waiting_APCal_base accesses the super-global variable $GLOBALS.
Open

    function b_waiting_APCal_base($moduleDirName)
    {
        $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
        $block   = array();

Severity: Minor
Found in include/waiting.plugin.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

b_waiting_APCal_base accesses the super-global variable $GLOBALS.
Open

    function b_waiting_APCal_base($moduleDirName)
    {
        $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
        $block   = array();

Severity: Minor
Found in include/waiting.plugin.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

b_waiting_APCal_base accesses the super-global variable $GLOBALS.
Open

    function b_waiting_APCal_base($moduleDirName)
    {
        $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
        $block   = array();

Severity: Minor
Found in include/waiting.plugin.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

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

        $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
Severity: Minor
Found in include/waiting.plugin.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 using static access to class 'XoopsDatabaseFactory' in method 'b_waiting_APCal_base'.
Open

        $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
Severity: Minor
Found in include/waiting.plugin.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

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 38 and the first side effect is on line 21.
Open

<?php
Severity: Minor
Found in include/waiting.plugin.php by phpcodesniffer

Line exceeds 120 characters; contains 186 characters
Open

        $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix("apcal{$mydirnumber}_event") . ' WHERE admission<1 AND (rrule_pid=0 OR rrule_pid=id)');
Severity: Minor
Found in include/waiting.plugin.php by phpcodesniffer

There are no issues that match your filters.

Category
Status