edmondscommerce/doctrine-static-meta

View on GitHub

Showing 42 of 53 total issues

File NamespaceHelper.php has 643 lines of code (exceeds 500 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration;
Severity: Major
Found in src/CodeGeneration/NamespaceHelper.php - About 5 hrs to fix

    Function replaceNestedDtoWithEntityInstanceIfIdsMatch has a Cognitive Complexity of 35 (exceeds 10 allowed). Consider refactoring.
    Open

        private function replaceNestedDtoWithEntityInstanceIfIdsMatch(
            DataTransferObjectInterface $dto,
            EntityInterface $entity
        ): void {
            $dtoHash = spl_object_hash($dto);
    Severity: Minor
    Found in src/Entity/Factory/EntityFactory.php - About 4 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

    AbstractEntityRepository has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class AbstractEntityRepository implements EntityRepositoryInterface
    {
        /**
         * @var array
         */
    Severity: Minor
    Found in src/Entity/Repositories/AbstractEntityRepository.php - About 3 hrs to fix

      Function updateNestedDtosWithFakeData has a Cognitive Complexity of 27 (exceeds 10 allowed). Consider refactoring.
      Open

          private function updateNestedDtosWithFakeData(DataTransferObjectInterface $dto): void
          {
              $reflection = new ReflectionClass(get_class($dto));
      
              $reflectionMethods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
      Severity: Minor
      Found in src/Entity/Testing/EntityGenerator/FakerDataFiller.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

      DoctrineStaticMeta has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class DoctrineStaticMeta
      {
          public const DSM_INIT_METHOD_PREFIX = 'dsmInit';
      
          /**
      Severity: Minor
      Found in src/DoctrineStaticMeta.php - About 3 hrs to fix

        Builder has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Builder
        {
        
            /**
             * @var EntityGenerator
        Severity: Minor
        Found in src/Builder/Builder.php - About 2 hrs to fix

          UnusedRelationsRemover has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class UnusedRelationsRemover
          {
              /**
               * @var NamespaceHelper
               */
          Severity: Minor
          Found in src/CodeGeneration/UnusedRelationsRemover.php - About 2 hrs to fix

            TestEntityGenerator has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class TestEntityGenerator
            {
                /**
                 * @var EntityManagerInterface
                 */
            Severity: Minor
            Found in src/Entity/Testing/EntityGenerator/TestEntityGenerator.php - About 2 hrs to fix

              Function update has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring.
              Open

                  final public function update(DataTransferObjectInterface $dto): void
                  {
                      $backup  = [];
                      $setters = self::getDoctrineStaticMeta()->getSetters();
                      try {
              Severity: Minor
              Found in src/Entity/Traits/AlwaysValidTrait.php - About 2 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 jsonSerialize has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring.
              Open

                  public function jsonSerialize(): array
                  {
                      $dsm         = static::getDoctrineStaticMeta();
                      $toSerialize = [];
                      $getters     = $dsm->getGetters();
              Severity: Minor
              Found in src/Entity/Traits/JsonSerializableTrait.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 createDtoRelatedToEntityDataObject has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
              Open

                  private function createDtoRelatedToEntityDataObject(
                      EntityData $owningDataObject,
                      string $relatedEntityFqn
                  ): DataTransferObjectInterface {
                      $relatedDtoFqn = $this->namespaceHelper->getEntityDtoFqnFromEntityFqn($relatedEntityFqn);
              Severity: Minor
              Found in src/Entity/DataTransferObjects/DtoFactory.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 getGettersForDtosOrCollections has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
              Open

                  private function getGettersForDtosOrCollections(DataTransferObjectInterface $dto): array
                  {
                      $dtoReflection     = new ReflectionClass(get_class($dto));
                      $dtoGetters        = [];
                      $collectionGetters = [];
              Severity: Minor
              Found in src/Entity/Factory/EntityFactory.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 deriveDtoAndEntityFqnFromCollection has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
              Open

                  private function deriveDtoAndEntityFqnFromCollection(Collection $collection): array
                  {
                      if (0 === $collection->count()) {
                          throw new RuntimeException('Collection is empty');
                      }
              Severity: Minor
              Found in src/Entity/Factory/EntityFactory.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 __construct has 15 arguments (exceeds 10 allowed). Consider refactoring.
              Open

                      EntityCreator $entityCreator,
                      AbstractEntityFactoryCreator $abstractEntityFactoryCreator,
                      EntityFactoryCreator $entityFactoryCreator,
                      EntityInterfaceCreator $entityInterfaceCreator,
                      AbstractEntityRepositoryCreator $abstractEntityRepositoryCreator,
              Severity: Major
              Found in src/CodeGeneration/Action/CreateEntityAction.php - About 1 hr to fix

                Function guessMissingColumnFormatters has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    private function guessMissingColumnFormatters(): void
                    {
                        $meta = $this->testedEntityDsm->getMetaData();
                        foreach ($meta->getFieldNames() as $fieldName) {
                            if (
                Severity: Minor
                Found in src/Entity/Testing/EntityGenerator/FakerDataFiller.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 theEntityGettersReturnValues has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
                Open

                    public function theEntityGettersReturnValues(EntityInterface $entity): EntityInterface
                    {
                        $meta = $this->getEntityManager()->getClassMetadata(static::$testedEntityFqn);
                        $dto  = $this->getDtoFactory()->createDtoFromEntity($entity);
                        foreach ($meta->getFieldNames() as $fieldName) {
                Severity: Minor
                Found in src/Entity/Testing/AbstractEntityTest.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 validateConfig has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
                Open

                    private function validateConfig(): void
                    {
                        $errors     = [];
                        $typeHelper = new TypeHelper();
                        foreach (ConfigInterface::PARAM_TYPES as $param => $requiredType) {
                Severity: Minor
                Found in src/Config.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 getGetters has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
                Open

                    public function getGetters(): array
                    {
                        if (null !== $this->getters) {
                            return $this->getters;
                        }
                Severity: Minor
                Found in src/DoctrineStaticMeta.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 createEntity has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
                Open

                    private function createEntity(
                        string $entityFqn,
                        DataTransferObjectInterface $dto = null,
                        $isRootEntity = true
                    ): EntityInterface {
                Severity: Minor
                Found in src/Entity/Factory/EntityFactory.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 __construct has 13 arguments (exceeds 10 allowed). Consider refactoring.
                Open

                        EntityGenerator $entityGenerator,
                        FieldGenerator $fieldGenerator,
                        EntityFieldSetter $fieldSetter,
                        RelationsGenerator $relationsGenerator,
                        ArchetypeEmbeddableGenerator $archetypeEmbeddableGenerator,
                Severity: Major
                Found in src/Builder/Builder.php - About 50 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language