XoopsModules25x/xoopstube

View on GitHub
class/VideosHandler.php

Summary

Maintainability
A
0 mins
Test Coverage

getActiveCriteria accesses the super-global variable $GLOBALS.
Open

    public function getActiveCriteria()
    {
        /** @var \XoopsGroupPermHandler $grouppermHandler */
        $grouppermHandler = \xoops_getHandler('groupperm');

Severity: Minor
Found in class/VideosHandler.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

getActiveCriteria accesses the super-global variable $GLOBALS.
Open

    public function getActiveCriteria()
    {
        /** @var \XoopsGroupPermHandler $grouppermHandler */
        $grouppermHandler = \xoops_getHandler('groupperm');

Severity: Minor
Found in class/VideosHandler.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

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

        $expiredCriteria = new \CriteriaCompo(new \Criteria('expired', 0));
Severity: Minor
Found in class/VideosHandler.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 '60', column '28').
Open

        $criteria->add(new \Criteria('published', 0, '>'));
Severity: Minor
Found in class/VideosHandler.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 '68', column '28').
Open

        $criteria->add(new \Criteria('cid', '(' . \implode(',', $allowedDownCategoriesIds) . ')', 'IN'));
Severity: Minor
Found in class/VideosHandler.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 '59', column '44').
Open

        $criteria = new \CriteriaCompo(new \Criteria('offline', false));
Severity: Minor
Found in class/VideosHandler.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 '61', column '28').
Open

        $criteria->add(new \Criteria('published', \time(), '<='));
Severity: Minor
Found in class/VideosHandler.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 '59', column '25').
Open

        $criteria = new \CriteriaCompo(new \Criteria('offline', false));
Severity: Minor
Found in class/VideosHandler.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 '63', column '35').
Open

        $expiredCriteria->add(new \Criteria('expired', \time(), '>='), 'OR');
Severity: Minor
Found in class/VideosHandler.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 '62', column '32').
Open

        $expiredCriteria = new \CriteriaCompo(new \Criteria('expired', 0));
Severity: Minor
Found in class/VideosHandler.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

Avoid using static access to class 'XoopsModules\Xoopstube\Helper' in method '__construct'.
Open

        $this->helper = Helper::getInstance();
Severity: Minor
Found in class/VideosHandler.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 excessively long variable names like $allowedDownCategoriesIds. Keep variable name length under 20.
Open

        $allowedDownCategoriesIds = $grouppermHandler->getItemIds('XTubeCatPerm', $groups, $this->helper->getModule()->mid());
Severity: Minor
Found in class/VideosHandler.php by phpmd

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

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

    public function __construct(\XoopsDatabase $db = null)
Severity: Minor
Found in class/VideosHandler.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

Line exceeds 120 characters; contains 138 characters
Open

        $groups                   = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [0 => XOOPS_GROUP_ANONYMOUS];
Severity: Minor
Found in class/VideosHandler.php by phpcodesniffer

Line exceeds 120 characters; contains 126 characters
Open

        $allowedDownCategoriesIds = $grouppermHandler->getItemIds('XTubeCatPerm', $groups, $this->helper->getModule()->mid());
Severity: Minor
Found in class/VideosHandler.php by phpcodesniffer

There are no issues that match your filters.

Category
Status