AppStateESS/InternshipInventory

View on GitHub

Showing 6,675 of 6,675 total issues

Avoid using static access to class '\PHPWS_Error' in method 'load'.
Open

        if (PHPWS_Error::logIfError($result)) {
Severity: Minor
Found in class/Model.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

The method handleRequest() has an NPath complexity of 780. The configured NPath complexity threshold is 200.
Open

    public function handleRequest()
    {
        // Check if it is time to add more term. If so, show a warning to admins.
        $futureTerms = TermFactory::getFutureTermsAssoc();
        if(sizeof($futureTerms) < 3 && \Current_User::isDeity()){
Severity: Minor
Found in class/InternshipInventory.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid unused private fields such as '$holds'.
Open

    private $holds;
Severity: Minor
Found in class/Student.php by phpmd

UnusedPrivateField

Since: 0.2

Detects when a private field is declared and/or assigned a value, but not used.

Example

class Something
{
    private static $FOO = 2; // Unused
    private $i = 5; // Unused
    private $j = 6;
    public function addOne()
    {
        return $this->j++;
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

Avoid using static access to class 'Intern\SubHostFactory' in method 'showWarnings'.
Open

        $message = SubHostFactory::getMessage($this->intern->getSubId());
Severity: Minor
Found in class/InternshipView.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 'showWarnings'.
Open

            \NQ::simple('intern', UI\NotifyUI::ERROR, "{$message['user_message']} {$message['email']}");
Severity: Minor
Found in class/InternshipView.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 unused local variables such as '$internHours'.
Open

        $internHours = $this->intern->getCreditHours();
Severity: Minor
Found in class/InternshipView.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 'Intern\PHPWS_Core' in method 'getStates'.
Open

            PHPWS_Core::goBack();
Severity: Minor
Found in class/State.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 unused local variables such as '$semester'.
Open

        $semester = $term->getSemesterType();
Severity: Minor
Found in class/Student.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 '\phpws2\Database' in method 'getMessage'.
Open

        $db = Database::newDB();
Severity: Minor
Found in class/SubHostFactory.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_DB' in method 'isTable'.
Open

        $tables = PHPWS_DB::listTables();
Severity: Minor
Found in class/SubselectDatabase.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

The method _getJoinOn uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $value2 = $table2 . '.' . $join_on_2[$key];
                }
Severity: Minor
Found in class/SubselectDatabase.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

The method getSubHostCond uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
          $stmt = $db->prepare("SELECT ish.id, ish.sub_name FROM intern_sub_host AS ish
            LEFT JOIN intern_special_host AS isp ON ish.sub_condition=isp.id
            WHERE ish.country=:country AND ish.main_host_id=:m_host_id AND ish.sub_approve_flag != 0
            AND (ish.sub_condition IS null OR isp.stop_level<>'Stop') ORDER BY ish.sub_name ASC");
Severity: Minor
Found in class/SubHostFactory.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

The method _getJoinOn uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $value1 = $table1 . '.' . $value;
                }
Severity: Minor
Found in class/SubselectDatabase.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Avoid using static access to class 'Intern\PdoFactory' in method 'getHostAssoc'.
Open

       $db = PdoFactory::getPdoInstance();
Severity: Minor
Found in class/SubHostFactory.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

The class SubselectDatabase has 2698 lines of code. Current threshold is 1000. Avoid really long classes.
Open

class SubselectDatabase extends PHPWS_DB{

    public function __construct($table = null)
    {
        parent::__construct($table);
Severity: Minor
Found in class/SubselectDatabase.php by phpmd

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

        $db = Database::newDB();
Severity: Minor
Found in class/SubHostFactory.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_DB' in method 'query'.
Open

            $sql = PHPWS_DB::prefixQuery($sql);
Severity: Minor
Found in class/SubselectDatabase.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_DB' in method 'query'.
Open

        PHPWS_DB::logDB($sql);
Severity: Minor
Found in class/SubselectDatabase.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_DB' in method 'isTable'.
Open

        PHPWS_DB::touchDB();
Severity: Minor
Found in class/SubselectDatabase.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

The method _getJoinOn() has an NPath complexity of 576. The configured NPath complexity threshold is 200.
Open

    public function _getJoinOn($join_on_1, $join_on_2, $table1, $table2, $ignore_tables = false)
    {
        if (empty($join_on_1) || empty($join_on_2)) {
            return null;
        }
Severity: Minor
Found in class/SubselectDatabase.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Severity
Category
Status
Source
Language