sjeguedes/symfonyBM_API

View on GitHub

Showing 23 of 27 total issues

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

class Partner implements UserInterface, JWTUserInterface
{
    /**
     * Define an APi admin role (associated to a partner special account).
     */
Severity: Minor
Found in src/Entity/Partner.php - About 3 hrs to fix

    HTTPCache has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class HTTPCache
    {
        /**
         * Define which kind of HTTP cache is used for a particular response.
         */
    Severity: Minor
    Found in src/Entity/HTTPCache.php - About 2 hrs to fix

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

      class Phone
      {
          /**
           * Define a set of phones categories.
           */
      Severity: Minor
      Found in src/Entity/Phone.php - About 2 hrs to fix

        Function loadSwaggerUI has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function loadSwaggerUI(userOptions = {}) {
          const data = JSON.parse(document.getElementById('swagger-data').innerText);
          const defaultOptions = {
            spec: data.spec,
            dom_id: '#swagger-ui',
        Severity: Minor
        Found in public/assets/bundles/nelmioapidoc/init-swagger-ui.js - About 1 hr to fix

          Method apply has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function apply(Request $request, ParamConverter $configuration): bool
              {
                  // Interrupt process if no uuid request attribute is found, or no special case matches!
                  if (null === $request->get('uuid') && !$this->setEntityUuidWithSpecialCase($request, $configuration)) {
                      return false;
          Severity: Minor
          Found in src/Services/API/ParamConverter/DoctrineCacheConverter.php - About 1 hr to fix

            Method loadValidatorMetadata has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function loadValidatorMetadata(ClassMetadata $metadata): void
                {
                    $metadata->addConstraint(
                        new UniqueEntity([
                            'fields' => ['brand', 'model']
            Severity: Minor
            Found in src/Entity/Phone.php - About 1 hr to fix

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

                  public function listClients(
                      FilterRequestHandler $requestHandler,
                      RepresentationBuilder $representationBuilder,
                      Request $request,
                      HTTPCache $httpCache
              Severity: Minor
              Found in src/Controller/ClientController.php - About 1 hr to fix

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

                    public function listPartners(
                        FilterRequestHandler $requestHandler,
                        RepresentationBuilder $representationBuilder,
                        Request $request,
                        HTTPCache $httpCache
                Severity: Minor
                Found in src/Controller/AdminPartnerController.php - About 1 hr to fix

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

                      public function listOffersPerPhone(
                          FilterRequestHandler $requestHandler,
                          Phone $phone,
                          RepresentationBuilder $representationBuilder,
                          Request $request,
                  Severity: Minor
                  Found in src/Controller/AdminOfferController.php - About 1 hr to fix

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

                        public function loadData(ObjectManager $manager): void
                        {
                            // Get existing companies sets
                            $data = DataProvider::PARTNER_COMPANY_SETS['references'];
                            // Use a row index per partner type (will be used for Proxy objects references)
                    Severity: Minor
                    Found in src/DataFixtures/PartnerFixtures.php - About 1 hr to fix

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

                          public function listPhones(
                              FilterRequestHandler $requestHandler,
                              RepresentationBuilder $representationBuilder,
                              Request $request,
                              HTTPCache $httpCache
                      Severity: Minor
                      Found in src/Controller/PhoneController.php - About 1 hr to fix

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

                            public function loadData(ObjectManager $manager): void
                            {
                                // Get all existing phones models
                                $data = DataProvider::PHONE_MODELS['references'];
                                // Use a row index per phone brand (will be used for Proxy objects references)
                        Severity: Minor
                        Found in src/DataFixtures/PhoneFixtures.php - About 1 hr to fix

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

                              public function listOffers(
                                  FilterRequestHandler $requestHandler,
                                  RepresentationBuilder $representationBuilder,
                                  Request $request,
                                  HTTPCache $httpCache
                          Severity: Minor
                          Found in src/Controller/AdminOfferController.php - About 1 hr to fix

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

                                private function invalidateHTTPCache(UuidInterface $entityUuid, string $className, bool $isRemoval = false): void
                                {
                                    /** @var HTTPCacheRepository $httpCacheRepository */
                                    $httpCacheRepository = $this->entityManager->getRepository(HTTPCache::class);
                                    $results = $httpCacheRepository->findBy(['classShortName' =>  self::ALLOWED_ENTITIES[$className]]);
                            Severity: Minor
                            Found in src/Services/API/Event/Subscriber/DoctrineSubscriber.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

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

                                public function onKernelRequest(RequestEvent $event): void
                                {
                                    if (!$event->isMasterRequest()) {
                                        return;
                                    }
                            Severity: Minor
                            Found in src/Services/API/Event/Listener/RequestListener.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

                            Method listPhonesPerPartner has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    FilterRequestHandler $requestHandler,
                                    Partner $partner,
                                    RepresentationBuilder $representationBuilder,
                                    Request $request,
                                    HTTPCache $httpCache
                            Severity: Minor
                            Found in src/Controller/AdminPhoneController.php - About 35 mins to fix

                              Method construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      DeserializationVisitorInterface $visitor,
                                      ClassMetadata $metadata,
                                      $data,
                                      array $type,
                                      DeserializationContext $context
                              Severity: Minor
                              Found in src/Services/JMS/EntityConstruction/ObjectConstructor.php - About 35 mins to fix

                                Method createJson has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        ?string $data,
                                        int $statusCode = 200,
                                        array $headers = [],
                                        bool $isAlreadyJson = true,
                                        int $httpCacheConfig = HTTPCache::NONE
                                Severity: Minor
                                Found in src/Services/API/Builder/ResponseBuilder.php - About 35 mins to fix

                                  Method listOffersPerPartner has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          FilterRequestHandler $requestHandler,
                                          Partner $partner,
                                          RepresentationBuilder $representationBuilder,
                                          Request $request,
                                          HTTPCache $httpCache
                                  Severity: Minor
                                  Found in src/Controller/AdminOfferController.php - About 35 mins to fix

                                    Method listOffersPerPhone has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                            FilterRequestHandler $requestHandler,
                                            Phone $phone,
                                            RepresentationBuilder $representationBuilder,
                                            Request $request,
                                            HTTPCache $httpCache
                                    Severity: Minor
                                    Found in src/Controller/AdminOfferController.php - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language