SU-SWS/stanford_migrate

View on GitHub
src/Form/StanfordMigrateImportForm.php

Summary

Maintainability
A
0 mins
Test Coverage
A
97%

Avoid using undefined variables such as '$row' which will lead to PHP notices.
Open

    $row['operations']['data'] = [

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$row' which will lead to PHP notices.
Open

    $row['status']['#markup'] = $migration->getStatusLabel();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$row' which will lead to PHP notices.
Open

      $row['last_imported']['#markup'] = $this->dateFormatter->format($last_imported / 1000, 'custom', 'M j Y g:i a');

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$row' which will lead to PHP notices.
Open

      $row['last_imported']['#markup'] = $this->t('Unknown');

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$row' which will lead to PHP notices.
Open

    $row['label']['#markup'] = $migration->label();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$row' which will lead to PHP notices.
Open

    $row['imported']['#markup'] = $migration->getIdMap()->importedCount();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$row' which will lead to PHP notices.
Open

    return $row;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

The class StanfordMigrateImportForm has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
Wontfix

class StanfordMigrateImportForm extends FormBase {

  /**
   * Array of migration plugin objects.
   *

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

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

Avoid assigning values to variables in if clauses and the like (line '155', column '9').
Open

  protected function buildRow(MigrationInterface $migration) {
    $row['label']['#markup'] = $migration->label();
    $row['status']['#markup'] = $migration->getStatusLabel();
    $row['imported']['#markup'] = $migration->getIdMap()->importedCount();

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Call with 3 arg(s) to \Drupal\stanford_migrate\StanfordMigrateBatchExecutable::__construct() which only takes 0 arg(s) defined at /code/src/StanfordMigrateBatchExecutable.php:17
Invalid

    $executable = new StanfordMigrateBatchExecutable($migration, $migrateMessage, $options);

There are no issues that match your filters.

Category
Status