src/Plugin/Action/CloneNode.php
Method buildConfigurationForm
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
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'),
Avoid using undefined variables such as '$node_ids' which will lead to PHP notices. Open
Open
$node_ids[] = $item[0];
- Read upRead up
- Exclude checks
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
Open
->loadMultiple($node_ids);
- Read upRead up
- Exclude checks
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
Open
class CloneNode extends ViewsBulkOperationsActionBase implements PluginFormInterface, ContainerFactoryPluginInterface {
/**
* {@inheritdoc}
*/
- Read upRead up
- Exclude checks
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
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) {
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Wontfix
Wontfix
return array_filter($fields, function($field) use ($clone_target_types) {
- Exclude checks
Parameter $original_title is not described in comment Wontfix
Wontfix
/**
- Exclude checks