AppStateESS/InternshipInventory

View on GitHub

Showing 6,675 of 6,675 total issues

The method getCSV() has an NPath complexity of 49152. The configured NPath complexity threshold is 200.
Open

    public function getCSV()
    {
        // Initalize term description list, if needed
        // Store term list in a static var, so hopefully we only do this once per export
        if(!isset(self::$termDescriptionList)){
Severity: Minor
Found in class/Internship.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

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

        } else {
            return $this->end_date;
        }
Severity: Minor
Found in class/Internship.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 setOiedCertified uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        }else{
            $this->oied_certified = 0;
        }
Severity: Minor
Found in class/Internship.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 '\PHPWS_Settings' in method 'getInternationalOfficeEmail'.
Open

        $result = \PHPWS_Settings::get('intern', 'internationalOfficeEmail');
Severity: Minor
Found in class/InternSettings.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_Settings' in method 'getStudentDataSource'.
Open

        $result = \PHPWS_Settings::get('intern', 'studentDataSource');
Severity: Minor
Found in class/InternSettings.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 getCSV uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else{
            $csv['Host Name'] = '';
            $csv['Host Sub Name'] = '';
            $csv['Host Address'] = '';
            $csv['Host City'] = '';
Severity: Minor
Found in class/Internship.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\LevelFactory' in method 'isUndergraduate'.
Open

        $level = LevelFactory::getLevelObjectById($this->getLevel());
Severity: Minor
Found in class/Internship.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 'getSupervisor'.
Open

        return SupervisorFactory::getSupervisorById($this->getSupervisorId());
Severity: Minor
Found in class/Internship.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\FacultyFactory' in method 'getFaculty'.
Open

        return FacultyFactory::getFacultyObjectById($this->faculty_id);
Severity: Minor
Found in class/Internship.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\EmergencyContactFactory' in method 'getEmergencyContactPhoneNumber'.
Open

        $phone = EmergencyContactFactory::getContactsForInternship($this);
Severity: Minor
Found in class/Internship.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 isRemote uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        }else{
            return false;
        }
Severity: Minor
Found in class/Internship.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 __construct has 11 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function __construct($id, $username, $firstName, $lastName, $phone, $fax, $streetAddress1, $streetAddress2, $city, $state, $zip)
    {
        $this->setId($id);
        $this->setUsername($username);

Severity: Minor
Found in class/Faculty.php by phpmd

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

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

        $this->setState(WorkflowStateFactory::getState('CreationState'));
Severity: Minor
Found in class/Internship.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 save() contains an exit expression.
Open

            exit($e->getMessage());
Severity: Minor
Found in class/Internship.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

Avoid using static access to class '\PHPWS_Text' in method 'getRowTags'.
Open

        $tags['WORKFLOW_STATE'] = PHPWS_Text::moduleLink($this->getWorkflowState()->getFriendlyName(), 'intern', array('action' => 'ShowInternship', 'internship_id' => $this->id));
Severity: Minor
Found in class/Internship.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_Text' in method 'getRowTags'.
Open

            $tags['FACULTY_NAME'] = PHPWS_Text::moduleLink(' ', 'intern', array('action' => 'ShowInternship', 'internship_id' => $this->id));
Severity: Minor
Found in class/Internship.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 getLevelFormatted uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else{
            return 'Unknown level';
        }
Severity: Minor
Found in class/Internship.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 generatePdf uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            }else{
                //break the string at a word before 50 chars
                $addr = wordwrap($fullAddress, 50);
                $addrFac1 = substr($addr, 0, strpos($addr, "\n"));
                $addrFac2 = substr($addr, strpos($addr, "\n"));
Severity: Minor
Found in class/InternshipContractPdfView.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 '\NQ' in method 'handleRequest'.
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, "There are less than three future terms available. It's probably time to add a new term.");
Severity: Minor
Found in class/InternshipInventory.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

Severity
Category
Status
Source
Language