components-web-app/api-components-bundle

View on GitHub

Showing 100 of 108 total issues

Method confirmNewEmailAddress has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function confirmNewEmailAddress(string $username, string $email, string $token): void
    {
        if ('' === $email) {
            throw new InvalidArgumentException('User not found');
        }
Severity: Minor
Found in src/Helper/User/EmailAddressManager.php - About 1 hr to fix

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

        protected function voteOnAttribute(string $attribute, $routable, TokenInterface $token): bool
        {
            if (!$this->securityStr) {
                return true;
            }
    Severity: Minor
    Found in src/Security/Voter/RoutableVoter.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 getPageDataTotal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getPageDataTotal(ComponentInterface $component): int
        {
            /** @var \Generator $pageDataLocations */
            $pageDataLocations = $this->pageDataProvider->findPageDataComponentMetadata($component);
            $pageDataCount = 0;
    Severity: Minor
    Found in src/Metadata/Factory/ComponentUsageMetadataFactory.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 onPreWrite has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function onPreWrite(ViewEvent $event): void
        {
            $request = $event->getRequest();
            $data = $request->attributes->get('data');
            $resourceClass = $request->attributes->get('_api_resource_class');
    Severity: Minor
    Found in src/EventListener/Api/OrphanedComponentEventListener.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 create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function create(RoutableInterface $object, ?Route $route = null): Route
        {
            $entityManager = $this->registry->getManagerForClass($className = $object::class);
            if (!$entityManager) {
                throw new InvalidArgumentException(sprintf('Could not find entity manager for %s', $className));
    Severity: Minor
    Found in src/Helper/Route/RouteGenerator.php - About 1 hr to fix

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

          public function getFileResponse(object $object, string $property, bool $forceDownload = false): Response
          {
              try {
                  $reflectionProperty = new \ReflectionProperty($object, $property);
              } catch (\ReflectionException $exception) {
      Severity: Minor
      Found in src/Helper/Uploadable/UploadableFileManager.php - About 1 hr to fix

        Method applyToItem has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, ?Operation $operation = null, array $context = []): void
            {
                $configuration = $this->getConfiguration($resourceClass);
        
                if (!$configuration || !$this->requestStack->getCurrentRequest()) {
        Severity: Minor
        Found in src/Doctrine/Extension/ORM/PublishableExtension.php - About 1 hr to fix

          Method validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function validate($componentPosition, Constraint $constraint): void
              {
                  $collection = $componentPosition->componentGroup;
                  if (!$collection) {
                      return;
          Severity: Minor
          Found in src/Validator/Constraints/ComponentPositionValidator.php - About 1 hr to fix

            Method normalize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function normalize($object, $format = null, array $context = []): float|array|\ArrayObject|bool|int|string|null
                {
                    $context[self::ALREADY_CALLED] = true;
            
                    $finalRoute = $object;
            Severity: Minor
            Found in src/Serializer/Normalizer/RouteNormalizer.php - About 1 hr to fix

              Method createFromRequest has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createFromRequest(Request $request, bool $normalization, ?array $extractedAttributes = null): array
                  {
                      $context = $this->decorated->createFromRequest($request, $normalization, $extractedAttributes);
              
                      if (
              Severity: Minor
              Found in src/Serializer/ContextBuilder/CwaResourceContextBuilder.php - About 1 hr to fix

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

                        ApiResourceRouteFinder $resourceRouteFinder,
                        ProviderInterface $provider,
                        RequestStack $requestStack,
                        SerializerContextBuilderInterface $serializerContextBuilder,
                        NormalizerInterface $itemNormalizer,
                Severity: Major
                Found in src/EventListener/Api/CollectionApiEventListener.php - About 1 hr to fix

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

                      private function prefixRoute(string $resourceClass, array $routePrefixParts, ResourceMetadataCollection $resourceMetadata): ResourceMetadataCollection
                      {
                          $resources = [];
                          /** @var ApiResource $resourceMetadatum */
                          foreach ($resourceMetadata as $i => $resourceMetadatum) {

                  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 onPostRespond has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function onPostRespond(ResponseEvent $event): void
                      {
                          $request = $event->getRequest();
                  
                          $attributes = $this->getAttributes($request);
                  Severity: Minor
                  Found in src/EventListener/Api/PublishableEventListener.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 addWhereByStrategy has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      protected function addWhereByStrategy(string $strategy, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $alias, string $field, $value, bool $caseSensitive): void
                  Severity: Major
                  Found in src/Filter/OrSearchFilter.php - About 50 mins to fix

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

                        public function __construct(ManagerRegistry $registry, UploadableAttributeReader $annotationReader, FilesystemProvider $filesystemProvider, FlysystemDataLoader $flysystemDataLoader, FileInfoCacheManager $fileInfoCacheManager, ?CacheManager $imagineCacheManager, ?FilterService $filterService = null)
                    Severity: Major
                    Found in src/Helper/Uploadable/UploadableFileManager.php - About 50 mins to fix

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

                          public function create(string $username, string $password, ?string $email = null, bool $inactive = false, bool $superAdmin = false, bool $admin = false, bool $overwrite = false): void
                      Severity: Major
                      Found in src/Factory/User/UserFactory.php - About 50 mins to fix

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

                            public function __construct(ContainerInterface $container, EventDispatcherInterface $eventDispatcher, string $subject, bool $enabled = true, ?string $defaultRedirectPath = null, ?string $redirectPathQueryKey = null, array $emailContext = [])
                        Severity: Major
                        Found in src/Factory/User/Mailer/AbstractUserEmailFactory.php - About 50 mins to fix

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

                              protected function filterProperty(string $property, $value, QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, ?Operation $operation = null, array $context = []): void
                          Severity: Major
                          Found in src/Filter/OrSearchFilter.php - About 50 mins to fix

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

                                public function __construct(EntityManagerInterface $entityManager, ValidatorInterface $validator, UserRepositoryInterface $userRepository, TimestampedDataPersister $timestampedDataPersister, UserPasswordHasherInterface $passwordHasher, string $userClass)
                            Severity: Minor
                            Found in src/Factory/User/UserFactory.php - About 45 mins to fix

                              Function __invoke has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function __invoke(FormSuccessEvent $event): void
                                  {
                                      // This is not a sub-request because forms have greater permissions to create entitites with whatever properties wanted.
                              
                                      if (
                              Severity: Minor
                              Found in src/EventListener/Form/EntityPersistFormListener.php - About 45 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

                              Severity
                              Category
                              Status
                              Source
                              Language