AppStateESS/InternshipInventory

View on GitHub
class/UI/SearchUI.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method display has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function display()
    {

        \javascript('jquery');
        \javascript('jquery_ui');
Severity: Major
Found in class/UI/SearchUI.php - About 2 hrs to fix

The method display() has 136 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function display()
    {

        \javascript('jquery');
        \javascript('jquery_ui');
Severity: Minor
Found in class/UI/SearchUI.php by phpmd

Missing class import via use statement (line '50', column '21').
Open

        $form = new \PHPWS_Form('internship');
Severity: Minor
Found in class/UI/SearchUI.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 using static access to class '\Intern\AssetResolver' in method 'display'.
Open

        $tpl['entry_bundle'] = AssetResolver::resolveJsPath('assets.json', 'searchInterface');
Severity: Minor
Found in class/UI/SearchUI.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\AssetResolver' in method 'display'.
Open

        $tpl['vendor_bundle'] = AssetResolver::resolveJsPath('assets.json', 'vendor');
Severity: Minor
Found in class/UI/SearchUI.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 'display'.
Open

        $hosts = SubHostFactory::getHostAssoc();
Severity: Minor
Found in class/UI/SearchUI.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 'display'.
Open

        $workflowStates = WorkflowStateFactory::getStatesAssoc();
Severity: Minor
Found in class/UI/SearchUI.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 'display'.
Open

        $terms = TermFactory::getTermsAssoc();
Severity: Minor
Found in class/UI/SearchUI.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\Subject' in method 'display'.
Open

        $subjects = array('-1' => 'Select subject ') + Subject::getSubjects();
Severity: Minor
Found in class/UI/SearchUI.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 display uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        }else{
            $depts = DepartmentFactory::getDepartmentsAssocForUsername(\Current_User::getUsername());
        }
Severity: Minor
Found in class/UI/SearchUI.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\DepartmentFactory' in method 'display'.
Open

            $depts = DepartmentFactory::getDepartmentsAssocForUsername(\Current_User::getUsername());
Severity: Minor
Found in class/UI/SearchUI.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 'display'.
Open

            $depts = DepartmentFactory::getDepartmentsAssocForUsername(\Current_User::getUsername());
Severity: Minor
Found in class/UI/SearchUI.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_Template' in method 'display'.
Open

        return \PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl');
Severity: Minor
Found in class/UI/SearchUI.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 'display'.
Open

        if(\Current_User::isDeity()){
Severity: Minor
Found in class/UI/SearchUI.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\DepartmentFactory' in method 'display'.
Open

            $depts = DepartmentFactory::getDepartmentsAssoc();
Severity: Minor
Found in class/UI/SearchUI.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\AssetResolver' in method 'display'.
Open

        $tpl['major_bundle'] = AssetResolver::resolveJsPath('assets.json', 'majorSelector');
Severity: Minor
Found in class/UI/SearchUI.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 setMethod from undeclared class \PHPWS_Form
Open

        $form->setMethod('get');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addSelect from undeclared class \PHPWS_Form
Open

        $form->addSelect('course_subj', $subjects);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addCssClass from undeclared class \PHPWS_Form
Open

        $form->addCssClass('start_date', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('name', "Name or Banner ID");
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setClass from undeclared class \PHPWS_Form
Open

        $form->setClass('course_no', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setSize from undeclared class \PHPWS_Form
Open

        $form->setSize('course_sect', 6);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addCheckAssoc from undeclared class \PHPWS_Form
Open

        $form->addCheckAssoc('workflow_state', $workflowStates);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addHidden from undeclared class \PHPWS_Form
Open

        $form->addHidden('faculty_id');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Possibly zero references to use statement for classlike/namespace Internship (\Intern\Internship)
Open

use Intern\Internship;
Severity: Minor
Found in class/UI/SearchUI.php by phan

Call to method addHidden from undeclared class \PHPWS_Form
Open

        $form->addHidden('action', 'results');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method isDeity from undeclared class \Current_User
Open

        if(\Current_User::isDeity()){
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addSelect from undeclared class \PHPWS_Form
Open

        $form->addSelect('host_select', array(-1 => 'All') + $hosts);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addText from undeclared class \PHPWS_Form
Open

        $form->addText('start_date');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method useRowRepeat from undeclared class \PHPWS_Form
Open

        $form->useRowRepeat();
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addText from undeclared class \PHPWS_Form
Open

        $form->addText('course_no');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setSize from undeclared class \PHPWS_Form
Open

        $form->setSize('course_no', 6);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('department', 'Department');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addSubmit from undeclared class \PHPWS_Form
Open

        $form->addSubmit('submit', 'Search');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method __construct from undeclared class \PHPWS_Form
Open

        $form = new \PHPWS_Form('internship');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setClass from undeclared class \PHPWS_Form
Open

        $form->setClass('term_select', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addSelect from undeclared class \PHPWS_Form
Open

        $form->addSelect('department', $depts);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to undeclared function \javascriptMod()
Open

        \javascriptMod('intern', 'formGoodies');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('start_date', 'Starting After');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addText from undeclared class \PHPWS_Form
Open

        $form->addText('end_date');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('end_date', 'Ending Before');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method mergeTemplate from undeclared class \PHPWS_Form
Open

        $form->mergeTemplate($tpl);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addSelect from undeclared class \PHPWS_Form
Open

        $form->addSelect('term_select', array(-1 => 'All') + $terms);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to undeclared function \javascript()
Open

        \javascript('jquery');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to undeclared function \javascript()
Open

        \javascript('jquery_ui');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('course_subj', 'Subject');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('term_select', 'Term');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('course_no', 'Course Number');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('host_select', 'Host');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setClass from undeclared class \PHPWS_Form
Open

        $form->setClass('host_select', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method getTemplate from undeclared class \PHPWS_Form
Open

        return \PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setClass from undeclared class \PHPWS_Form
Open

        $form->setClass('course_subj', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addText from undeclared class \PHPWS_Form
Open

        $form->addText('course_sect');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method getUsername from undeclared class \Current_User
Open

            $depts = DepartmentFactory::getDepartmentsAssocForUsername(\Current_User::getUsername());
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addCssClass from undeclared class \PHPWS_Form
Open

        $form->addCssClass('faculty', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method process from undeclared class \PHPWS_Template
Open

        return \PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addHidden from undeclared class \PHPWS_Form
Open

        $form->addHidden('module', 'intern');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setMaxSize from undeclared class \PHPWS_Form
Open

        $form->setMaxSize('course_sect', 4);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setClass from undeclared class \PHPWS_Form
Open

        $form->setClass('department', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setMatch from undeclared class \PHPWS_Form
Open

            $form->setMatch('department', $keys[1]);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('faculty', 'Faculty Supervisor / Instructor of Record');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addText from undeclared class \PHPWS_Form
Open

        $form->addText('name');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setMaxSize from undeclared class \PHPWS_Form
Open

        $form->setMaxSize('course_no', 4);
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setExtra from undeclared class \PHPWS_Form
Open

        $form->setExtra('faculty', 'disabled');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('course_sect', 'Section');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method setClass from undeclared class \PHPWS_Form
Open

        $form->setClass('course_sect', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addSelect from undeclared class \PHPWS_Form
Open

        $form->addSelect('faculty', array(-1=>'Select Faculty Supervisor'));
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to method addCssClass from undeclared class \PHPWS_Form
Open

        $form->addCssClass('end_date', 'form-control');
Severity: Critical
Found in class/UI/SearchUI.php by phan

Call to undeclared function \javascriptMod()
Open

        javascriptMod('intern', 'resetSearch');
Severity: Critical
Found in class/UI/SearchUI.php by phan

There are no issues that match your filters.

Category
Status