AppStateESS/InternshipInventory

View on GitHub
class/Command/DeleteInternship.php

Summary

Maintainability
A
1 hr
Test Coverage

execute accesses the super-global variable $_REQUEST.
Open

    public function execute()
    {
        // Check permissions
        if(!\Current_User::isDeity()){
            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'You do not have permission to delete internships.');
Severity: Minor
Found in class/Command/DeleteInternship.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 execute has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute()
    {
        // Check permissions
        if(!\Current_User::isDeity()){
            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'You do not have permission to delete internships.');
Severity: Minor
Found in class/Command/DeleteInternship.php - About 1 hr to fix

Avoid using static access to class '\phpws2\Database' in method 'execute'.
Open

        $db = Database::newDB();
Severity: Minor
Found in class/Command/DeleteInternship.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 '\NQ' in method 'execute'.
Open

            \NQ::close();
Severity: Minor
Found in class/Command/DeleteInternship.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 '\Current_User' in method 'execute'.
Open

        if(!\Current_User::isDeity()){
Severity: Minor
Found in class/Command/DeleteInternship.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 '\NQ' in method 'execute'.
Open

            \NQ::close();
Severity: Minor
Found in class/Command/DeleteInternship.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 '\NQ' in method 'execute'.
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "Could not delete the internship.");
Severity: Minor
Found in class/Command/DeleteInternship.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 '\NQ' in method 'execute'.
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::SUCCESS, "Successfully deleted the internship.");
Severity: Minor
Found in class/Command/DeleteInternship.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 '\PHPWS_Core' in method 'execute'.
Open

            return \PHPWS_Core::reroute('index.php?module=intern&action=search');
Severity: Minor
Found in class/Command/DeleteInternship.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 '\NQ' in method 'execute'.
Open

            \NQ::close();
Severity: Minor
Found in class/Command/DeleteInternship.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 '\PHPWS_Core' in method 'execute'.
Open

            return \PHPWS_Core::reroute('index.php?module=intern&action=ShowInternship&internship_id=' . $id);
Severity: Minor
Found in class/Command/DeleteInternship.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 '\PHPWS_Core' in method 'execute'.
Open

            \PHPWS_Core::home();
Severity: Minor
Found in class/Command/DeleteInternship.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 '\NQ' in method 'execute'.
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'You do not have permission to delete internships.');
Severity: Minor
Found in class/Command/DeleteInternship.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

Call to method home from undeclared class \PHPWS_Core
Open

            \PHPWS_Core::home();
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method simple from undeclared class \NQ
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "Could not delete the internship.");
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method newDB from undeclared class \phpws2\Database
Open

        $db = Database::newDB();
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method close from undeclared class \NQ
Open

            \NQ::close();
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method close from undeclared class \NQ
Open

            \NQ::close();
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method simple from undeclared class \NQ
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::SUCCESS, "Successfully deleted the internship.");
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method simple from undeclared class \NQ
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'You do not have permission to delete internships.');
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method reroute from undeclared class \PHPWS_Core
Open

            return \PHPWS_Core::reroute('index.php?module=intern&action=ShowInternship&internship_id=' . $id);
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method close from undeclared class \NQ
Open

            \NQ::close();
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method isDeity from undeclared class \Current_User
Open

        if(!\Current_User::isDeity()){
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

Call to method reroute from undeclared class \PHPWS_Core
Open

            return \PHPWS_Core::reroute('index.php?module=intern&action=search');
Severity: Critical
Found in class/Command/DeleteInternship.php by phan

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

        $id = $_REQUEST['internship_id'];
Severity: Minor
Found in class/Command/DeleteInternship.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

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

        $db = Database::newDB();
Severity: Minor
Found in class/Command/DeleteInternship.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