AppStateESS/InternshipInventory

View on GitHub
class/UI/EditAgreementUI.php

Summary

Maintainability
A
1 hr
Test Coverage

display accesses the super-global variable $_GET.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.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

display accesses the super-global variable $_REQUEST.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.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

display accesses the super-global variable $_REQUEST.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.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

display accesses the super-global variable $_REQUEST.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.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 display has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.php - About 1 hr to fix

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

        $form = new \PHPWS_Form('edit_affil');
Severity: Minor
Found in class/UI/EditAgreementUI.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 '\Current_User' in method 'display'.
Open

        if(!\Current_User::allow('intern', 'affiliation_agreement')){
Severity: Minor
Found in class/UI/EditAgreementUI.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/EditAgreementUI.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['department_bundle'] = AssetResolver::resolveJsPath('assets.json', 'affiliationDepartments');
Severity: Minor
Found in class/UI/EditAgreementUI.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\AffiliationAgreementFactory' in method 'display'.
Open

        $affiliate_agreement = AffiliationAgreementFactory::getAffiliationById($aaId);
Severity: Minor
Found in class/UI/EditAgreementUI.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 'display'.
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.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['location_bundle'] = AssetResolver::resolveJsPath('assets.json', 'affiliationLocation');
Severity: Minor
Found in class/UI/EditAgreementUI.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['terminate_bundle'] = AssetResolver::resolveJsPath('assets.json', 'affiliationTerminate');
Severity: Minor
Found in class/UI/EditAgreementUI.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

        $v = \PHPWS_Template::process($form->getTemplate(), 'intern', 'editAffiliate.tpl');
Severity: Minor
Found in class/UI/EditAgreementUI.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['uploadAffil_bundle'] = AssetResolver::resolveJsPath('assets.json', 'affiliationUpload');
Severity: Minor
Found in class/UI/EditAgreementUI.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 addCssClass from undeclared class \PHPWS_Form
Open

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

Call to method setAction from undeclared class \PHPWS_Form
Open

        $form->setAction('index.php?module=intern&action=saveAffiliate&affiliation_agreement_id='.$aaId);
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method addText from undeclared class \PHPWS_Form
Open

        $form->addText('begin_date', date('m/d/Y', $affiliate_agreement->getBeginDate()));
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('name', 'Affiliate Name');
Severity: Critical
Found in class/UI/EditAgreementUI.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/EditAgreementUI.php by phan

Call to method getTemplate from undeclared class \PHPWS_Form
Open

        $v = \PHPWS_Template::process($form->getTemplate(), 'intern', 'editAffiliate.tpl');
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('auto_renew', 'Auto-Renew');
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

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

Call to method addCssClass from undeclared class \PHPWS_Form
Open

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

Call to method addText from undeclared class \PHPWS_Form
Open

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

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('begin_date', 'Beginning Date');
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method setLabel from undeclared class \PHPWS_Form
Open

        $form->setLabel('notes', 'Notes');
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method setMatch from undeclared class \PHPWS_Form
Open

          $form->setMatch('auto_renew', 'yes');
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Argument 1 (id) is string|string[] but \Intern\AffiliationAgreementFactory::getAffiliationById() takes int defined at /code/class/AffiliationAgreementFactory.php:35
Open

        $affiliate_agreement = AffiliationAgreementFactory::getAffiliationById($aaId);
Severity: Minor
Found in class/UI/EditAgreementUI.php by phan

Call to method plugIn from undeclared class \PHPWS_Form
Open

            $form->plugIn($_GET);
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method addText from undeclared class \PHPWS_Form
Open

        $form->addText('end_date', date('m/d/Y',$affiliate_agreement->getEndDate()));
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method simple from undeclared class \NQ
Open

            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method process from undeclared class \PHPWS_Template
Open

        $v = \PHPWS_Template::process($form->getTemplate(), 'intern', 'editAffiliate.tpl');
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method allow from undeclared class \Current_User
Open

        if(!\Current_User::allow('intern', 'affiliation_agreement')){
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method addCheck from undeclared class \PHPWS_Form
Open

        $form->addCheck('auto_renew', 'yes');
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

Call to method mergeTemplate from undeclared class \PHPWS_Form
Open

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

Call to method __construct from undeclared class \PHPWS_Form
Open

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

Call to method addCssClass from undeclared class \PHPWS_Form
Open

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

Call to method addTextArea from undeclared class \PHPWS_Form
Open

        $form->addTextArea('notes', $affiliate_agreement->getNotes());
Severity: Critical
Found in class/UI/EditAgreementUI.php by phan

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

        $v = \PHPWS_Template::process($form->getTemplate(), 'intern', 'editAffiliate.tpl');
Severity: Minor
Found in class/UI/EditAgreementUI.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

The variable $affiliate_agreement is not named in camelCase.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $affiliate_agreement is not named in camelCase.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $affiliate_agreement is not named in camelCase.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $affiliate_agreement is not named in camelCase.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $affiliate_agreement is not named in camelCase.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $affiliate_agreement is not named in camelCase.
Open

    public function display()
    {
        /* Check if user should have access to Affiliate Agreement page */
        if(!\Current_User::allow('intern', 'affiliation_agreement')){
            \NQ::simple('intern', \Intern\UI\NotifyUI::WARNING, 'You do not have permission to add Affiliate Agreements.');
Severity: Minor
Found in class/UI/EditAgreementUI.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status