src/UserAction/StepExecutorTrait.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using static access to class '\Atk4\Core\Factory' in method 'addStepTitle'.
Open

            $view->add(Factory::factory($seed));
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 jsStepSubmit uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            // store data and setup reload
            $js = new JsBlock([
                $this->loader->jsAddStoreData($this->actionData, true),
                $this->loader->jsLoad(
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '\Atk4\Core\Factory' in method 'doArgs'.
Open

                $val['model'] = Factory::factory($val['model']);
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '\Atk4\Ui\View' in method 'doPreview'.
Open

                $preview = View::addTo($page, ['ui' => 'basic segment']);
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '\Atk4\Ui\View' in method 'doPreview'.
Open

                $preview = View::addTo($page, ['ui' => 'basic segment']);
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 doArgs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $form->addControl($key, [], $val);
            }
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '\Atk4\Ui\View' in method 'doPreview'.
Open

                $preview = View::addTo($page, ['ui' => 'inverted black segment', 'element' => 'pre']);
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '\Atk4\Ui\View' in method 'doFinal'.
Open

        View::addTo($page, ['content' => $this->finalMsg]);
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 jsSetButtonsState uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $view->js(true, $this->jsSetPreviousState($step));
            $view->js(true, $this->jsSetNextState($step));
            $view->js(true, $this->jsSetExecuteState($step));
        }
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '\Atk4\Core\Factory' in method 'addFormTo'.
Open

        $f = $view->add(Factory::factory($this->formSeed));
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '\Atk4\Ui\Button' in method 'createButtonBar'.
Open

        $this->nextStepButton = Button::addTo($this->buttonsView, ['Next', 'class.blue' => true]);
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '$val'.
Open

        foreach ($this->action->args as $key => $val) {
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 '$val'.
Open

        foreach ($this->action->args as $key => $val) {
Severity: Minor
Found in src/UserAction/StepExecutorTrait.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 variables with short names like $f. Configured minimum length is 3.
Open

        $f = $view->add(Factory::factory($this->formSeed));
Severity: Minor
Found in src/UserAction/StepExecutorTrait.php by phpmd

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

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

            $js = $this->jsGetExecute($return, $this->action->getEntity()->getId());
Severity: Minor
Found in src/UserAction/StepExecutorTrait.php by phpmd

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

Line exceeds 120 characters; contains 176 characters
Open

                        $this->name => $this->getApp()->uiPersistence->typecastAttributeSaveField($this->action->getModel()->getIdField(), $this->action->getEntity()->getId()),

Line exceeds 120 characters; contains 172 characters
Open

                    $this->name => $this->getApp()->uiPersistence->typecastAttributeSaveField($this->action->getModel()->getIdField(), $this->action->getEntity()->getId()),

Line exceeds 120 characters; contains 126 characters
Open

        $this->executeActionButton = $this->getExecutorFactory()->createTrigger($this->action, ExecutorFactory::MODAL_BUTTON);

Line exceeds 120 characters; contains 126 characters
Open

        $this->previousStepButton = Button::addTo($this->buttonsView, ['Previous'])->setStyle(['float' => 'left !important']);

Line exceeds 120 characters; contains 172 characters
Open

                    $this->name => $this->getApp()->uiPersistence->typecastAttributeSaveField($this->action->getModel()->getIdField(), $this->action->getEntity()->getId()),

Line exceeds 120 characters; contains 168 characters
Open

    /** @var JsExpressionable|\Closure<T of Model>($this, T, mixed, mixed): ?JsBlock JS expression to return if action was successful, e.g "new JsToast('Thank you')" */

Line exceeds 120 characters; contains 176 characters
Open

                        $this->name => $this->getApp()->uiPersistence->typecastAttributeSaveField($this->action->getModel()->getIdField(), $this->action->getEntity()->getId()),

There are no issues that match your filters.

Category
Status