SU-SWS/stanford_fields

View on GitHub
src/Service/StanfordFieldsBookManager.php

Summary

Maintainability
A
0 mins
Test Coverage
A
92%

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

class StanfordFieldsBookManager implements BookManagerInterface {
 
use StringTranslationTrait;
 
/**

StanfordFieldsBookManager has 27 functions (exceeds 25 allowed). Consider refactoring.
Wontfix

class StanfordFieldsBookManager implements BookManagerInterface {
 
use StringTranslationTrait;
 
/**
Severity: Minor
Found in src/Service/StanfordFieldsBookManager.php - About 2 hrs to fix

    Method addFormElements has 70 lines of code (exceeds 40 allowed). Consider refactoring.
    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()
    Severity: Major
    Found in src/Service/StanfordFieldsBookManager.php - About 2 hrs to fix

      Function updateOutline has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      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.
      Severity: Minor
      Found in src/Service/StanfordFieldsBookManager.php - About 55 mins to fix

      The method addFormElements() has 100 lines of code. Current threshold is set to 100. Avoid really long methods.
      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()

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

      public function __construct(protected BookManagerInterface $bookManager, protected ConfigFactoryInterface $configFactory, protected EventDispatcherInterface $eventDispatcher, protected EntityTypeManagerInterface $entityTypeManager) {}
      Severity: Critical
      Found in src/Service/StanfordFieldsBookManager.php by phan

      Variable $nid is undefined.
      Invalid

      $weights[$nid] = $weight;

      Expected 1 space before "|"; 0 found
      Invalid

      protected function getSiblingBookItems(int $parent_id, int|string $current_nid): array {

      Expected 1 space before "|"; 0 found
      Open

      public function getTableOfContents(int|string $bid, int $depth_limit, array $exclude = [], bool $truncate = TRUE): array {

      Variable $nid is undefined.
      Invalid

      [, $nid] = explode(':', $key);

      Expected 1 space before "|"; 0 found
      Open

      public function getLinkDefaults(int|string $nid): array {

      Expected 1 space after "|"; 0 found
      Open

      public function getLinkDefaults(int|string $nid): array {

      Expected 1 space after "|"; 0 found
      Invalid

      protected function getSiblingBookItems(int $parent_id, int|string $current_nid): array {

      Expected 1 space after "|"; 0 found
      Open

      public function getTableOfContents(int|string $bid, int $depth_limit, array $exclude = [], bool $truncate = TRUE): array {

      There are no issues that match your filters.

      Category
      Status