renatoaraujo/debug

View on GitHub

Showing 33 of 33 total issues

The method printr() contains an exit expression.
Open

            exit(self::displayHtmlBody());
Severity: Minor
Found in src/Debug.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

Avoid using static access to class '\Renatoaraujo\Debug' in method 'testDebugDump'.
Open

        $strDebug = Debug::dump($param1, $param2);
Severity: Minor
Found in tests/DebugTest.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 printr() contains an exit expression.
Open

            exit($strDisplay);
Severity: Minor
Found in src/Debug.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

Avoid using static access to class '\Renatoaraujo\Debug' in method 'testDebugLog'.
Open

        $boolDebug = Debug::log($param1, $param2);
Severity: Minor
Found in tests/DebugTest.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 applyHtmlTags uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $strVarType = gettype($mixValue);

            switch ($strVarType) {
                case 'string':
Severity: Minor
Found in src/Debug.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

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

        } else {
            echo $strDisplay;
        }
Severity: Minor
Found in src/Debug.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 '\Renatoaraujo\Debug' in method 'testDebugConsole'.
Open

        $boolDebug = Debug::console($param1, $param2);
Severity: Minor
Found in tests/DebugTest.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 '\Renatoaraujo\Debug' in method 'testDebugPrintr'.
Open

        $strDebug = Debug::printr($param1, $param2);
Severity: Minor
Found in tests/DebugTest.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 dump() contains an exit expression.
Open

            exit($strDisplay);
Severity: Minor
Found in src/Debug.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

displayHtmlBody accesses the super-global variable $_SERVER.
Open

    protected static function displayHtmlBody()
    {
        $strServerUrlRequestContext = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' .
            "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}";

Severity: Minor
Found in src/Debug.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

displayHtmlBody accesses the super-global variable $_SERVER.
Open

    protected static function displayHtmlBody()
    {
        $strServerUrlRequestContext = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' .
            "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}";

Severity: Minor
Found in src/Debug.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

displayHtmlBody accesses the super-global variable $_SERVER.
Open

    protected static function displayHtmlBody()
    {
        $strServerUrlRequestContext = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' .
            "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}";

Severity: Minor
Found in src/Debug.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

displayHtmlBody accesses the super-global variable $_SERVER.
Open

    protected static function displayHtmlBody()
    {
        $strServerUrlRequestContext = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' .
            "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}";

Severity: Minor
Found in src/Debug.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

Severity
Category
Status
Source
Language