YetiForceCompany/YetiForceCRM

View on GitHub
app/SystemWarnings/YetiForce/Registration.php

Summary

Maintainability
A
0 mins
Test Coverage
C
75%

Avoid using static access to class '\App\YetiForce\Register' in method 'process'.
Open

        if (\App\YetiForce\Register::isRegistered() || 'demo' === \App\Config::main('systemMode')) {

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 '\App\Config' in method 'process'.
Open

        if (\App\YetiForce\Register::isRegistered() || 'demo' === \App\Config::main('systemMode')) {

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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->status = 0;
        }

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

Call to method isRegistered from undeclared class \App\YetiForce\Register
Open

        if (\App\YetiForce\Register::isRegistered() || 'demo' === \App\Config::main('systemMode')) {

Spaces must be used to indent lines; tabs are not allowed
Open

    public function process(): void

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $tpl = true;

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->status = 0;

Spaces must be used to indent lines; tabs are not allowed
Open

     * Checking if registration is correct and display modal with info if not.

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->status = 1;

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $priority = 8;

Spaces must be used to indent lines; tabs are not allowed
Open

        } else {

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $title = 'LBL_REGISTRATION';

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\App\YetiForce\Register::isRegistered() || 'demo' === \App\Config::main('systemMode')) {

There are no issues that match your filters.

Category
Status