mambax7/smartpartner

View on GitHub
admin/main.php

Summary

Maintainability
C
1 day
Test Coverage

Avoid using static access to class '\XoopsModules\Smartpartner\Utility' in method 'pathConfiguration'.
Open

    $image_path = Smartpartner\Utility::getImageDir();
Severity: Minor
Found in admin/main.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 '\XoopsModules\Smartpartner\Utility' in method 'pathConfiguration'.
Open

    echo "<td class='even' style='text-align: center;'>" . Smartpartner\Utility::getPathStatusAsAdmin('images/category') . '</td></tr>';
Severity: Minor
Found in admin/main.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 '\XoopsModules\Smartpartner\Utility' in method 'pathConfiguration'.
Open

    Smartpartner\Utility::closeCollapsable('configtable', 'configtableicon');
Severity: Minor
Found in admin/main.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 '\XoopsModules\Smartpartner\Utility' in method 'pathConfiguration'.
Open

    Smartpartner\Utility::collapsableBar('configtable', 'configtableicon', _AM_SPARTNER_PATHCONFIGURATION);
Severity: Minor
Found in admin/main.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 '\XoopsModules\Smartpartner\Utility' in method 'pathConfiguration'.
Open

    echo "<td class='even' style='text-align: center;'>" . Smartpartner\Utility::getPathStatusAsAdmin('images') . '</td></tr>';
Severity: Minor
Found in admin/main.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 '\XoopsModules\Smartpartner\Utility' in method 'pathConfiguration'.
Open

    $image_path = Smartpartner\Utility::getImageDir('category');
Severity: Minor
Found in admin/main.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 '$xoopsConfig'.
Open

    global $xoopsConfig,  $xoopsModule;
Severity: Minor
Found in admin/main.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 unused local variables such as '$xoopsModule'.
Open

    global $xoopsModule;
Severity: Minor
Found in admin/main.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 unused local variables such as '$xoopsModule'.
Open

    global $xoopsConfig,  $xoopsModule;
Severity: Minor
Found in admin/main.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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

            case _SPARTNER_STATUS_ACTIVE:
                $statustxt = _AM_SPARTNER_ACTIVE;
                $approve   = '';
                $modify    = "<a href='partner.php?op=mod&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SPARTNER_PARTNER_EDIT . "' alt='" . _AM_SPARTNER_PARTNER_EDIT . "'></a>&nbsp;";
                $delete    = "<a href='partner.php?op=del&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/delete.png' . "'  title='" . _AM_SPARTNER_PARTNER_DELETE . "' alt='" . _AM_SPARTNER_PARTNER_DELETE . "'></a>&nbsp;";
Severity: Major
Found in admin/main.php and 2 other locations - About 2 hrs to fix
admin/main.php on lines 299..304
admin/main.php on lines 306..311

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 137.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

            case _SPARTNER_STATUS_REJECTED:
                $statustxt = _AM_SPARTNER_REJECTED;
                $approve   = '';
                $modify    = "<a href='partner.php?op=mod&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SPARTNER_PARTNER_EDIT . "' alt='" . _AM_SPARTNER_PARTNER_EDIT . "'></a>&nbsp;";
                $delete    = "<a href='partner.php?op=del&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/delete.png' . "'  title='" . _AM_SPARTNER_PARTNER_DELETE . "' alt='" . _AM_SPARTNER_PARTNER_DELETE . "'></a>&nbsp;";
Severity: Major
Found in admin/main.php and 2 other locations - About 2 hrs to fix
admin/main.php on lines 292..297
admin/main.php on lines 299..304

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 137.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

            case _SPARTNER_STATUS_INACTIVE:
                $statustxt = _AM_SPARTNER_INACTIVE;
                $approve   = '';
                $modify    = "<a href='partner.php?op=mod&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SPARTNER_PARTNER_EDIT . "' alt='" . _AM_SPARTNER_PARTNER_EDIT . "'></a>&nbsp;";
                $delete    = "<a href='partner.php?op=del&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/delete.png' . "'  title='" . _AM_SPARTNER_PARTNER_DELETE . "' alt='" . _AM_SPARTNER_PARTNER_DELETE . "'></a>&nbsp;";
Severity: Major
Found in admin/main.php and 2 other locations - About 2 hrs to fix
admin/main.php on lines 292..297
admin/main.php on lines 306..311

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 137.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 63 and the first side effect is on line 13.
Open

<?php
Severity: Minor
Found in admin/main.php by phpcodesniffer

There must be one blank line after the last USE statement; 0 found;
Open

use XoopsModules\Smartpartner\Constants;
Severity: Minor
Found in admin/main.php by phpcodesniffer

Blank line found at start of control structure
Open

        switch ($partnersObj[$i]->status()) {
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 145 characters
Open

//echo "<input type='button' name='button' onclick=\"location='category.php?op=mod'\" value='" . _AM_SPARTNER_CATEGORY_CREATE . "'>&nbsp;&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 232 characters
Open

                $modify    = "<a href='partner.php?op=mod&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SPARTNER_PARTNER_EDIT . "' alt='" . _AM_SPARTNER_PARTNER_EDIT . "'></a>&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 239 characters
Open

                $delete    = "<a href='partner.php?op=del&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/delete.png' . "'  title='" . _AM_SPARTNER_PARTNER_DELETE . "' alt='" . _AM_SPARTNER_PARTNER_DELETE . "'></a>&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 126 characters
Open

//echo "<td class='head'>" . _AM_SPARTNER_TOTAL_REJECTED . "</td><td align='center' class='even'>" . $totalrejected . "</td>";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 232 characters
Open

                $modify    = "<a href='partner.php?op=mod&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SPARTNER_PARTNER_EDIT . "' alt='" . _AM_SPARTNER_PARTNER_EDIT . "'></a>&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 150 characters
Open

//if ((Smartpartner\Utility::getPathStatusAsAdmin('images', true) < 0) || (Smartpartner\Utility::getPathStatusAsAdmin('images/category', true) < 0)) {
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 127 characters
Open

    echo "<td class='even' style='text-align: center;'>" . Smartpartner\Utility::getPathStatusAsAdmin('images') . '</td></tr>';
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 132 characters
Open

            <td><span style='font-weight: bold; font-variant: small-caps;'>" . _AM_SPARTNER_SHOWING . ' ' . $caption . "</span></td>
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 238 characters
Open

                $approve   = "<a href='partner.php?op=mod&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/on.png' . "'   title='" . _AM_SPARTNER_PARTNER_APPROVE . "' alt='" . _AM_SPARTNER_PARTNER_APPROVE . "'></a>&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 248 characters
Open

        echo "<td class='head' align='left'><a href='" . SMARTPARTNER_URL . 'partner.php?id=' . $partnersObj[$i]->id() . "'><img src='" . SMARTPARTNER_URL . "assets/images/links/partner.gif' alt=''>&nbsp;" . $partnersObj[$i]->title() . '</a></td>';
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 143 characters
Open

//echo "<input type='button' name='button' onclick=\"location='partner.php?op=add'\" value='" . _AM_SPARTNER_PARTNER_CREATE . "'>&nbsp;&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 239 characters
Open

                $delete    = "<a href='partner.php?op=del&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/delete.png' . "'  title='" . _AM_SPARTNER_PARTNER_DELETE . "' alt='" . _AM_SPARTNER_PARTNER_DELETE . "'></a>&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 171 characters
Open

$pagenav = new \XoopsPageNav($numrows, $helper->getConfig('perpage_admin'), $startentry, 'startentry', "statussel=$statussel&amp;sortsel=$sortsel&amp;ordersel=$ordersel");
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 126 characters
Open

//echo "<td class='head'>" . _AM_SPARTNER_TOTAL_INACTIVE . "</td><td align='center' class='even'>" . $totalinactive . "</td>";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 168 characters
Open

    <table width='100%' cellspacing='1' cellpadding='2' border='0' style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'>
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 239 characters
Open

                $delete    = "<a href='partner.php?op=del&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/delete.png' . "'  title='" . _AM_SPARTNER_PARTNER_DELETE . "' alt='" . _AM_SPARTNER_PARTNER_DELETE . "'></a>&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 132 characters
Open

$partnersObj = $partnerHandler->getPartners($helper->getConfig('perpage_admin'), $startentry, $statusSelected, $sortsel, $ordersel);
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 128 characters
Open

//echo "<td class='head'>" . _AM_SPARTNER_TOTAL_SUBMITTED . "</td><td align='center' class='even'>" . $totalsubmitted . "</td>";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

//echo "<td class='head'>" . _AM_SPARTNER_TOTAL_ACTIVE . "</td><td align='center' class='even'>" . $totalactive . "</td>";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">$status_explaination</span>";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 239 characters
Open

                $delete    = "<a href='partner.php?op=del&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/delete.png' . "'  title='" . _AM_SPARTNER_PARTNER_DELETE . "' alt='" . _AM_SPARTNER_PARTNER_DELETE . "'></a>&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 136 characters
Open

    echo "<td class='even' style='text-align: center;'>" . Smartpartner\Utility::getPathStatusAsAdmin('images/category') . '</td></tr>';
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 232 characters
Open

                $modify    = "<a href='partner.php?op=mod&id=" . $partnersObj[$i]->id() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SPARTNER_PARTNER_EDIT . "' alt='" . _AM_SPARTNER_PARTNER_EDIT . "'></a>&nbsp;";
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 124 characters
Open

    echo '<div style="text-align:right; background-color: white; margin: 10px 0;">' . $pagenav->renderImageNav() . '</div>';
Severity: Minor
Found in admin/main.php by phpcodesniffer

Line exceeds 120 characters; contains 148 characters
Open

if ((Smartpartner\Utility::getPathStatusAsAdmin('images', true) > 0) && (Smartpartner\Utility::getPathStatusAsAdmin('images/category', true) > 0)) {
Severity: Minor
Found in admin/main.php by phpcodesniffer

Expected 1 space after closing brace; newline found
Open

                }
Severity: Minor
Found in admin/main.php by phpcodesniffer

The variable $image_path is not named in camelCase.
Open

function pathConfiguration()
{
    global $xoopsModule;
    // Upload and Images Folders
    Smartpartner\Utility::collapsableBar('configtable', 'configtableicon', _AM_SPARTNER_PATHCONFIGURATION);
Severity: Minor
Found in admin/main.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 $image_path is not named in camelCase.
Open

function pathConfiguration()
{
    global $xoopsModule;
    // Upload and Images Folders
    Smartpartner\Utility::collapsableBar('configtable', 'configtableicon', _AM_SPARTNER_PATHCONFIGURATION);
Severity: Minor
Found in admin/main.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 $image_path is not named in camelCase.
Open

function pathConfiguration()
{
    global $xoopsModule;
    // Upload and Images Folders
    Smartpartner\Utility::collapsableBar('configtable', 'configtableicon', _AM_SPARTNER_PATHCONFIGURATION);
Severity: Minor
Found in admin/main.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 $image_path is not named in camelCase.
Open

function pathConfiguration()
{
    global $xoopsModule;
    // Upload and Images Folders
    Smartpartner\Utility::collapsableBar('configtable', 'configtableicon', _AM_SPARTNER_PATHCONFIGURATION);
Severity: Minor
Found in admin/main.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