jon48/webtrees-lib

View on GitHub
app/Module/GeoDispersion/Views/AbstractGeoAnalysisView.php

Summary

Maintainability
A
1 hr
Test Coverage

The class AbstractGeoAnalysisView has 13 public methods. Consider refactoring AbstractGeoAnalysisView to keep number of public methods under 10.
Open

abstract class AbstractGeoAnalysisView
{
    private int $id;
    private Tree $tree;
    private bool $enabled;

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

        int $id,
        Tree $tree,
        bool $enabled,
        string $description,
        GeoAnalysisInterface $geoanalysis,
Severity: Major
Found in app/Module/GeoDispersion/Views/AbstractGeoAnalysisView.php - About 1 hr to fix

    Method with has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            bool $enabled,
            string $description,
            GeoAnalysisInterface $geoanalysis,
            int $depth,
            int $detailed_top_places = 0,
    Severity: Minor
    Found in app/Module/GeoDispersion/Views/AbstractGeoAnalysisView.php - About 45 mins to fix

      The method with has a boolean flag argument $use_flags, which is a certain sign of a Single Responsibility Principle violation.
      Open

              bool $use_flags = false

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method __construct has a boolean flag argument $use_flags, which is a certain sign of a Single Responsibility Principle violation.
      Open

              bool $use_flags = false

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      Avoid using short method names like AbstractGeoAnalysisView::id(). The configured minimum method name length is 3.
      Open

          public function id(): int
          {
              return $this->id;
          }

      ShortMethodName

      Since: 0.2

      Detects when very short method names are used.

      Example

      class ShortMethod {
          public function a( $index ) { // Violation
          }
      }

      Source https://phpmd.org/rules/naming.html#shortmethodname

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          private int $id;

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          public function withId(int $id): self

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

              int $id,

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      There are no issues that match your filters.

      Category
      Status