src/EventSubscriber/EntityEventSubscriber.php
File EntityEventSubscriber.php
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
Wontfix
<?php
namespace Drupal\stanford_profile_helper\EventSubscriber;
use Drupal\config_pages\ConfigPagesInterface;
EntityEventSubscriber
has 23 functions (exceeds 20 allowed). Consider refactoring. Wontfix
Wontfix
class EntityEventSubscriber implements EventSubscriberInterface {
use MessengerTrait;
use StringTranslationTrait;
Method preSaveNode
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function preSaveNode(NodeInterface $entity): void {
// Invalidate any search result cached so the updated/new content will be
// displayed for previously searched terms.
Cache::invalidateTags(['config:views.view.search']);
The class EntityEventSubscriber has a coupling between objects value of 24. Consider to reduce the number of dependencies under 13. Wontfix
Wontfix
class EntityEventSubscriber implements EventSubscriberInterface {
use MessengerTrait;
use StringTranslationTrait;
- 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)
Open
Open
public function __construct(protected StanfordDefaultContentInterface $defaultContent, protected StateInterface $state, protected EntityTypeManagerInterface $entityTypeManager) {}
- Exclude checks
Doc comment short description must start with a capital letter Open
Open
* {@inheritDoc}
- Exclude checks
Doc comment short description must end with a full stop Open
Open
* {@inheritDoc}
- Exclude checks