SU-SWS/stanford_actions

View on GitHub
src/Plugin/Action/CloneNode.php

Summary

Maintainability
A
0 mins
Test Coverage
A
96%

Method buildConfigurationForm has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

  public function buildConfigurationForm(array $form, FormStateInterface $form_state): array {
    $values = range(1, 10);
    $form['clone_count'] = [
      '#type' => 'select',
      '#title' => $this->t('Clone how many times'),
Severity: Minor
Found in src/Plugin/Action/CloneNode.php - About 1 hr to fix

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

          $node_ids[] = $item[0];
    Severity: Minor
    Found in src/Plugin/Action/CloneNode.php by phpmd

    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 '$node_ids' which will lead to PHP notices.
    Open

          ->loadMultiple($node_ids);
    Severity: Minor
    Found in src/Plugin/Action/CloneNode.php by phpmd

    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 CloneNode has a coupling between objects value of 22. Consider to reduce the number of dependencies under 13.
    Open

    class CloneNode extends ViewsBulkOperationsActionBase implements PluginFormInterface, ContainerFactoryPluginInterface {
    
      /**
       * {@inheritdoc}
       */
    Severity: Minor
    Found in src/Plugin/Action/CloneNode.php by phpmd

    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

    syntax error, unexpected 'protected' (T_PROTECTED), expecting variable (T_VARIABLE)
    Invalid

      public function __construct(array $configuration, $plugin_id, $plugin_definition, protected EntityFieldManagerInterface $entityFieldManager, protected EntityTypeManagerInterface $entityTypeManager, protected FieldCloneManagerInterface $fieldCloneManager, ConfigFactoryInterface $config_factory, protected AccountProxyInterface $currentUser, protected EventDispatcherInterface $eventDispatcher) {
    Severity: Critical
    Found in src/Plugin/Action/CloneNode.php by phan

    Expected 1 space after FUNCTION keyword; 0 found
    Wontfix

        return array_filter($fields, function($field) use ($clone_target_types) {

    Parameter $original_title is not described in comment
    Wontfix

      /**

    There are no issues that match your filters.

    Category
    Status