Finesse/Wired

View on GitHub

Showing 30 of 34 total issues

File BelongsToMany.php has 338 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Finesse\Wired\Relations;

use Finesse\MiniDB\Database;
Severity: Minor
Found in src/Relations/BelongsToMany.php - About 4 hrs to fix

    Method attach has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function attach(
            Mapper $mapper,
            array $parents,
            array $children,
            string $onMatch,
    Severity: Major
    Found in src/Relations/BelongsToMany.php - About 3 hrs to fix

      Function updateAttachmentsGroup has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function updateAttachmentsGroup(
              $parentId,
              $childId,
              array $parents,
              array $children,
      Severity: Minor
      Found in src/Relations/BelongsToMany.php - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function attach has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function attach(
              Mapper $mapper,
              array $parents,
              array $children,
              string $onMatch,
      Severity: Minor
      Found in src/Relations/BelongsToMany.php - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method updateAttachmentsGroup has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function updateAttachmentsGroup(
              $parentId,
              $childId,
              array $parents,
              array $children,
      Severity: Major
      Found in src/Relations/BelongsToMany.php - About 2 hrs to fix

        Method loadCyclicRelativesForModelsOfSameClass has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function loadCyclicRelativesForModelsOfSameClass(
                array $models,
                string $relationName,
                \Closure $clause = null,
                bool $onlyMissing = false
        Severity: Minor
        Found in src/MapperFeatures/LoadTrait.php - About 2 hrs to fix

          Function filterModelRelatives has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function filterModelRelatives(ModelInterface $model, string $relation, callable $filter)
              {
                  if (!$model->doesHaveLoadedRelatives($relation)) {
                      return;
                  }
          Severity: Minor
          Found in src/Helpers.php - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method loadRelatives has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function loadRelatives(Mapper $mapper, string $name, array $parents, \Closure $constraint = null)
              {
                  if (!$parents) {
                      return;
                  }
          Severity: Minor
          Found in src/Relations/BelongsToMany.php - About 1 hr to fix

            Method saveModel has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function saveModel(ModelInterface $model, string $mode)
                {
                    $identifierField = $model::getIdentifierField();
                    $row = $model->convertToRow();
                    $doUpdate = false;
            Severity: Minor
            Found in src/Mapper.php - About 1 hr to fix

              Function loadRelatives has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function loadRelatives(Mapper $mapper, string $name, array $parents, \Closure $constraint = null)
                  {
                      if (!$parents) {
                          return;
                      }
              Severity: Minor
              Found in src/Relations/BelongsToMany.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method filterModelRelatives has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function filterModelRelatives(ModelInterface $model, string $relation, callable $filter)
                  {
                      if (!$model->doesHaveLoadedRelatives($relation)) {
                          return;
                      }
              Severity: Minor
              Found in src/Helpers.php - About 1 hr to fix

                Function collectModelsRelatives has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function collectModelsRelatives(array $models, string $relation): array
                    {
                        $modelsSet = new \SplObjectStorage;
                        foreach ($models as $model) {
                            $modelsSet->attach($model);
                Severity: Minor
                Found in src/Helpers.php - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function loadCyclicRelativesForModelsOfSameClass has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function loadCyclicRelativesForModelsOfSameClass(
                        array $models,
                        string $relationName,
                        \Closure $clause = null,
                        bool $onlyMissing = false
                Severity: Minor
                Found in src/MapperFeatures/LoadTrait.php - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function loadRelatives has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function loadRelatives(Mapper $mapper, string $name, array $parents, \Closure $constraint = null)
                    {
                        if (!$parents) {
                            return;
                        }
                Severity: Minor
                Found in src/Relations/EqualFields.php - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function wrapException has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function wrapException(\Throwable $exception): \Throwable
                    {
                        if ($exception instanceof ExceptionInterface) {
                            return $exception;
                        }
                Severity: Minor
                Found in src/Helpers.php - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method loadRelatives has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function loadRelatives(Mapper $mapper, string $name, array $parents, \Closure $constraint = null)
                    {
                        if (!$parents) {
                            return;
                        }
                Severity: Minor
                Found in src/Relations/EqualFields.php - About 1 hr to fix

                  Function loadRelativesForModelsOfSameClass has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function loadRelativesForModelsOfSameClass(
                          array $models,
                          string $relationName,
                          \Closure $clause = null,
                          bool $onlyMissing = false
                  Severity: Minor
                  Found in src/MapperFeatures/LoadTrait.php - About 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function saveModel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function saveModel(ModelInterface $model, string $mode)
                      {
                          $identifierField = $model::getIdentifierField();
                          $row = $model->convertToRow();
                          $doUpdate = false;
                  Severity: Minor
                  Found in src/Mapper.php - About 55 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Method attachWithDetails has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $parents,
                          string $relationName,
                          $children,
                          string $onMatch,
                          bool $detachOther,
                  Severity: Major
                  Found in src/MapperFeatures/AttachTrait.php - About 50 mins to fix

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

                            string $modelClass,
                            string $pivotParentField,
                            string $pivotTable,
                            string $pivotChildField,
                            string $parentIdentifierField = null,
                    Severity: Minor
                    Found in src/Relations/BelongsToMany.php - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language