src/Service/StanfordFieldsBookManager.php
Showing 5 of 14 total issues
The class StanfordFieldsBookManager has 18 public methods. Consider refactoring StanfordFieldsBookManager to keep number of public methods under 10. Wontfix
Wontfix
class StanfordFieldsBookManager implements BookManagerInterface { use StringTranslationTrait; /**
- Read upRead up
- Exclude checks
StanfordFieldsBookManager
has 27 functions (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
class StanfordFieldsBookManager implements BookManagerInterface { use StringTranslationTrait; /**
Method addFormElements
has 70 lines of code (exceeds 40 allowed). Consider refactoring. Wontfix
Wontfix
public function addFormElements(array $form, FormStateInterface $form_state, NodeInterface $node, AccountInterface $account, bool $collapsed = TRUE): array { // The book module will add the book settings to all node types for admins, // which makes it annoying. This checks the node against the settings // instead of only the 'administer book outlines' permission. // @see book_form_node_form_alter()
Function updateOutline
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Wontfix
Wontfix
public function updateOutline(NodeInterface $node): bool { if (isset($node->book['weight'])) { // Before saving the node, look at the book weight data . The weight has // to be an integer, but we also have to adjust the weights of the sibling // book items so that they all stay in proper order.
- Read upRead up
The method addFormElements() has 100 lines of code. Current threshold is set to 100. Avoid really long methods. Wontfix
Wontfix
public function addFormElements(array $form, FormStateInterface $form_state, NodeInterface $node, AccountInterface $account, bool $collapsed = TRUE): array { // The book module will add the book settings to all node types for admins, // which makes it annoying. This checks the node against the settings // instead of only the 'administer book outlines' permission. // @see book_form_node_form_alter()
- Exclude checks
syntax error, unexpected 'protected' (T_PROTECTED), expecting variable (T_VARIABLE)
Open
Open
public function __construct(protected BookManagerInterface $bookManager, protected ConfigFactoryInterface $configFactory, protected EventDispatcherInterface $eventDispatcher, protected EntityTypeManagerInterface $entityTypeManager) {}
- Exclude checks
Variable $nid is undefined. Invalid
Invalid
$weights[$nid] = $weight;
- Exclude checks
Expected 1 space before "|"; 0 found Invalid
Invalid
protected function getSiblingBookItems(int $parent_id, int|string $current_nid): array {
- Exclude checks
Expected 1 space before "|"; 0 found Open
Open
public function getTableOfContents(int|string $bid, int $depth_limit, array $exclude = [], bool $truncate = TRUE): array {
- Exclude checks
Variable $nid is undefined. Invalid
Invalid
[, $nid] = explode(':', $key);
- Exclude checks
Expected 1 space before "|"; 0 found Open
Open
public function getLinkDefaults(int|string $nid): array {
- Exclude checks
Expected 1 space after "|"; 0 found Open
Open
public function getLinkDefaults(int|string $nid): array {
- Exclude checks
Expected 1 space after "|"; 0 found Invalid
Invalid
protected function getSiblingBookItems(int $parent_id, int|string $current_nid): array {
- Exclude checks
Expected 1 space after "|"; 0 found Open
Open
public function getTableOfContents(int|string $bid, int $depth_limit, array $exclude = [], bool $truncate = TRUE): array {
- Exclude checks