ImpressCMS/impresscms

View on GitHub
htdocs/modules/system/admin/blockspadmin/main.php

Summary

Maintainability
A
0 mins
Test Coverage

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

    } else {
        $sform = $blockObj->getForm(_AM_SYSTEM_BLOCKSPADMIN_CREATE, 'addblockposition');
        $sform->assign($icmsAdminTpl);

    }

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

Reference to undeclared constant \_NOPERM
Open

    exit(_NOPERM);

Call to method __construct from undeclared class \icms_ipf_view_Column
Open

            $objectTable->addColumn(new icms_ipf_view_Column('pname'), 'center');

Variable $icmsAdminTpl is undeclared
Open

            $icmsAdminTpl->assign('icms_blockposition_table', $objectTable->fetch());

Variable $icmsAdminTpl is undeclared
Open

            $icmsAdminTpl->assign('lang_badmin', _AM_SYSTEM_BLOCKSPADMIN_TITLE);

Reference to static property user from undeclared class \icms
Open

if (!is_object(icms::$user) || !is_object($icmsModule) || !icms::$user->isAdmin($icmsModule->getVar('mid'))) {

Call to method __construct from undeclared class \icms_ipf_Controller
Open

            $controller = new icms_ipf_Controller($icms_blockposition_handler);

Call to method storeFromDefaultForm from undeclared class \icms_ipf_Controller
Open

            $controller->storeFromDefaultForm(_AM_SYSTEM_BLOCKSPADMIN_CREATED, _AM_SYSTEM_BLOCKSPADMIN_MODIFIED);

Call to method __construct from undeclared class \icms_ipf_view_Column
Open

            $objectTable->addColumn(new icms_ipf_view_Column('description'));

Call to method addQuickSearch from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addQuickSearch(array('pname', 'title', 'description'));

Call to method fetch from undeclared class \icms_ipf_view_Table
Open

            $icmsAdminTpl->assign('icms_blockposition_table', $objectTable->fetch());

Call to method __construct from undeclared class \icms_ipf_view_Column
Open

            $objectTable->addColumn(new icms_ipf_view_Column('title', FALSE, FALSE, 'getCustomTitle', FALSE, FALSE, FALSE));

Call to method handleObjectDeletion from undeclared class \icms_ipf_Controller
Open

            $controller->handleObjectDeletion();

Call to method addColumn from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addColumn(new icms_ipf_view_Column('pname'), 'center');

Variable $icmsAdminTpl is undeclared
Open

            $icmsAdminTpl->assign('icms_blockposition_info', _AM_SYSTEM_BLOCKSPADMIN_INFO);

Call to method addColumn from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addColumn(new icms_ipf_view_Column('title', FALSE, FALSE, 'getCustomTitle', FALSE, FALSE, FALSE));

Call to method addIntroButton from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addIntroButton('addblockposition', 'admin.php?fct=blockspadmin&op=mod', _AM_SYSTEM_BLOCKSPADMIN_CREATE);

Call to method __construct from undeclared class \icms_ipf_Controller
Open

            $controller = new icms_ipf_Controller($icms_blockposition_handler);

Call to method addColumn from undeclared class \icms_ipf_view_Table
Open

            $objectTable->addColumn(new icms_ipf_view_Column('description'));

Variable $icmsModule is undeclared
Open

if (!is_object(icms::$user) || !is_object($icmsModule) || !icms::$user->isAdmin($icmsModule->getVar('mid'))) {

Call to method __construct from undeclared class \icms_ipf_view_Table
Open

            $objectTable = new icms_ipf_view_Table($icms_blockposition_handler, FALSE);

Variable $icmsAdminTpl is undeclared
Open

            $icmsAdminTpl->display('db:system_adm_blockspadmin.html');

Avoid excessively long variable names like $icms_blockposition_handler. Keep variable name length under 20.
Open

    global $icms_blockposition_handler, $icmsAdminTpl;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

function editblockposition($id = 0) {

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

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable->addColumn(new icms_ipf_view_Column('title', FALSE, FALSE, 'getCustomTitle', FALSE, FALSE, FALSE));

TRUE, FALSE and NULL must be lowercase; expected "true" but found "TRUE"
Open

if (in_array($clean_op, $valid_op, TRUE)) {

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable->addColumn(new icms_ipf_view_Column('title', FALSE, FALSE, 'getCustomTitle', FALSE, FALSE, FALSE));

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable = new icms_ipf_view_Table($icms_blockposition_handler, FALSE);

The CASE body must start on the line following the statement
Open

        case "changedField":

Blank line found at end of control structure
Open


TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable->addColumn(new icms_ipf_view_Column('title', FALSE, FALSE, 'getCustomTitle', FALSE, FALSE, FALSE));

Blank line found at end of control structure
Open


TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable->addColumn(new icms_ipf_view_Column('title', FALSE, FALSE, 'getCustomTitle', FALSE, FALSE, FALSE));

Blank line found at start of control structure
Open

if (in_array($clean_op, $valid_op, TRUE)) {

TRUE, FALSE and NULL must be lowercase; expected "false" but found "FALSE"
Open

            $objectTable->addColumn(new icms_ipf_view_Column('title', FALSE, FALSE, 'getCustomTitle', FALSE, FALSE, FALSE));

Inline control structures are not allowed
Open

if (isset($_POST['op'])) $clean_op = htmlentities($_POST['op']);

Inline control structures are not allowed
Open

if (isset($_GET['op'])) $clean_op = htmlentities($_GET['op']);

The variable $icms_blockposition_handler is not named in camelCase.
Open

function editblockposition($id = 0) {
    global $icms_blockposition_handler, $icmsAdminTpl;

    $blockObj = $icms_blockposition_handler->get($id);

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 $icms_blockposition_handler is not named in camelCase.
Open

function editblockposition($id = 0) {
    global $icms_blockposition_handler, $icmsAdminTpl;

    $blockObj = $icms_blockposition_handler->get($id);

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