AppStateESS/InternshipInventory

View on GitHub
class/Command/ShowInternship.php

Summary

Maintainability
A
1 hr
Test Coverage

execute accesses the super-global variable $_REQUEST.
Open

    public function execute()
    {
        // Make sure an 'internship_id' key is set on the request
        if(!isset($_REQUEST['internship_id'])) {
            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'No internship ID was given.');
Severity: Minor
Found in class/Command/ShowInternship.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

execute accesses the super-global variable $_REQUEST.
Open

    public function execute()
    {
        // Make sure an 'internship_id' key is set on the request
        if(!isset($_REQUEST['internship_id'])) {
            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'No internship ID was given.');
Severity: Minor
Found in class/Command/ShowInternship.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 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute()
    {
        // Make sure an 'internship_id' key is set on the request
        if(!isset($_REQUEST['internship_id'])) {
            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'No internship ID was given.');
Severity: Minor
Found in class/Command/ShowInternship.php - About 1 hr to fix

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

            \PHPWS_Core::reroute('index.php');
Severity: Minor
Found in class/Command/ShowInternship.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 locate an internship with the given ID.');
Severity: Minor
Found in class/Command/ShowInternship.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 '\Intern\InternshipFactory' in method 'execute'.
Open

            $intern = InternshipFactory::getInternshipById($_REQUEST['internship_id']);
Severity: Minor
Found in class/Command/ShowInternship.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, 'No internship ID was given.');
Severity: Minor
Found in class/Command/ShowInternship.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::WARNING, "We couldn't find a student with an ID of {$studentId} in Banner. This probably means this person is not an active student.");
Severity: Minor
Found in class/Command/ShowInternship.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/ShowInternship.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 locate an internship with the given ID.');
Severity: Minor
Found in class/Command/ShowInternship.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 '\Intern\SubHostFactory' in method 'execute'.
Open

        $host = SubHostFactory::getSubById($intern->getSubId());
Severity: Minor
Found in class/Command/ShowInternship.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 '\Intern\SupervisorFactory' in method 'execute'.
Open

        $supervisor = SupervisorFactory::getSupervisorById($intern->getSupervisorId());
Severity: Minor
Found in class/Command/ShowInternship.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 '\Intern\TermFactory' in method 'execute'.
Open

        $term = TermFactory::getTermByTermCode($intern->getTerm());
Severity: Minor
Found in class/Command/ShowInternship.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

TODO found
Open

            //TODO redirect to the search interface
Severity: Minor
Found in class/Command/ShowInternship.php by fixme

Call to method simple from undeclared class \NQ
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'Could not locate an internship with the given ID.');
Severity: Critical
Found in class/Command/ShowInternship.php by phan

Call to method simple from undeclared class \NQ
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'No internship ID was given.');
Severity: Critical
Found in class/Command/ShowInternship.php by phan

Call to method simple from undeclared class \NQ
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'Could not locate an internship with the given ID.');
Severity: Critical
Found in class/Command/ShowInternship.php by phan

Argument 1 (termCode) is int but \Intern\TermFactory::getTermByTermCode() takes string defined at /code/class/TermFactory.php:32
Open

        $term = TermFactory::getTermByTermCode($intern->getTerm());
Severity: Minor
Found in class/Command/ShowInternship.php by phan

Call to method reroute from undeclared class \PHPWS_Core
Open

            \PHPWS_Core::reroute('index.php');
Severity: Critical
Found in class/Command/ShowInternship.php by phan

Call to method simple from undeclared class \NQ
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, "We couldn't find a student with an ID of {$studentId} in Banner. This probably means this person is not an active student.");
Severity: Critical
Found in class/Command/ShowInternship.php by phan

Call to method close from undeclared class \NQ
Open

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

There are no issues that match your filters.

Category
Status