XoopsModules25x/userlog

View on GitHub
class/form/simpleform.php

Summary

Maintainability
A
0 mins
Test Coverage

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

            } else {
                $ret .= $ele->render() . "\n";
            }
Severity: Minor
Found in class/form/simpleform.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

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class UserlogSimpleForm extends XoopsForm
Severity: Minor
Found in class/form/simpleform.php by phpcodesniffer

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 30 and the first side effect is on line 20.
Open

<?php
Severity: Minor
Found in class/form/simpleform.php by phpcodesniffer

Line exceeds 120 characters; contains 186 characters
Open

        $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n";
Severity: Minor
Found in class/form/simpleform.php by phpcodesniffer

Line exceeds 120 characters; contains 136 characters
Open

                $ret .= '<div class="' . $ele->getClass() . '"><strong>' . $ele->getCaption() . '</strong>' . $ele->render() . '</div>';
Severity: Minor
Found in class/form/simpleform.php by phpcodesniffer

There are no issues that match your filters.

Category
Status