mambax7/extgallery

View on GitHub
class/PublicRatingHandler.php

Summary

Maintainability
A
0 mins
Test Coverage

rate accesses the super-global variable $GLOBALS.
Open

    public function rate($photoId, $rating)
    {
        /** @var Extgallery\PublicPhotoHandler $photoHandler */
        $photoHandler = $helper->getHandler('Publicphoto', 'extgallery');

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

rate accesses the super-global variable $GLOBALS.
Open

    public function rate($photoId, $rating)
    {
        /** @var Extgallery\PublicPhotoHandler $photoHandler */
        $photoHandler = $helper->getHandler('Publicphoto', 'extgallery');

Severity: Minor
Found in class/PublicRatingHandler.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 using undefined variables such as '$helper' which will lead to PHP notices.
Open

        $photoHandler = $helper->getHandler('Publicphoto', 'extgallery');
Severity: Minor
Found in class/PublicRatingHandler.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Missing class import via use statement (line '90', column '28').
Open

        $criteria->add(new \Criteria('photo_id', $rate->getVar('photo_id')));
Severity: Minor
Found in class/PublicRatingHandler.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 '89', column '25').
Open

        $criteria = new \CriteriaCompo();
Severity: Minor
Found in class/PublicRatingHandler.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 '71', column '25').
Open

        $criteria = new \Criteria('photo_id', $photoId);
Severity: Minor
Found in class/PublicRatingHandler.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 '91', column '28').
Open

        $criteria->add(new \Criteria('uid', $rate->getVar('uid')));
Severity: Minor
Found in class/PublicRatingHandler.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 unused local variables such as '$helper'.
Open

        $photoHandler = $helper->getHandler('Publicphoto', 'extgallery');
Severity: Minor
Found in class/PublicRatingHandler.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 $db. Configured minimum length is 3.
Open

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

There are no issues that match your filters.

Category
Status