FrankProjects/UltimateWarfare

View on GitHub

Showing 103 of 141 total issues

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

    public function executeOperation(Request $request, int $regionId, int $operationId, int $playerRegionId): Response
    {
        $operationResults = [];
        $player = $this->getPlayer();

Severity: Minor
Found in src/Controller/Game/OperationController.php - About 1 hr to fix

    Method remove has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function remove(Player $player): void
        {
            foreach ($player->getMarketItems() as $marketItem) {
                $this->entityManager->remove($marketItem);
            }
    Severity: Minor
    Found in src/Repository/Doctrine/DoctrinePlayerRepository.php - About 1 hr to fix

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

          public function sendGameUnits(
              WorldRegion $region,
              WorldRegion $targetRegion,
              Player $player,
              GameUnitType $gameUnitType,
      Severity: Minor
      Found in src/Service/Action/FleetActionService.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 buildForm has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function buildForm(FormBuilderInterface $builder, array $options): void
          {
              $builder
                  ->add(
                      'title',
      Severity: Minor
      Found in src/Form/Admin/GameNewsType.php - About 1 hr to fix

        Method constructGameUnits has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function constructGameUnits(Request $request, int $regionId, int $gameUnitTypeId): Response
            {
                /**
                 * XXX TODO: Fix unit info page
                 * XXX TODO: Fix buildtime to human readable format
        Severity: Minor
        Found in src/Controller/Game/ConstructionController.php - About 1 hr to fix

          Method acceptFederationApplication has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function acceptFederationApplication(Player $player, int $applicationId): void
              {
                  $this->ensureFederationEnabled($player);
                  $federation = $player->getFederation();
                  if ($federation === null) {
          Severity: Minor
          Found in src/Service/Action/FederationApplicationActionService.php - About 1 hr to fix

            Method uploadAvatar has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function uploadAvatar(Request $request): Response
                {
                    $user = $this->getGameUser();
                    $form = $this->createForm(UploadAvatarType::class);
                    $form->handleRequest($request);
            Severity: Minor
            Found in src/Controller/Game/UserController.php - About 1 hr to fix

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

                  public function withdraw(Player $player, array $resources): void
                  {
                      $this->ensureFederationEnabled($player);
              
                      $federation = $player->getFederation();
              Severity: Minor
              Found in src/Service/Action/FederationBankActionService.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 addFleetUnitToFleet has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function addFleetUnitToFleet(WorldRegion $region, GameUnit $gameUnit, int $amount, Fleet $fleet): void
                  {
                      $hasUnit = false;
                      foreach ($region->getWorldRegionUnits() as $regionUnit) {
                          if ($regionUnit->getGameUnit()->getId() == $gameUnit->getId()) {
              Severity: Minor
              Found in src/Service/Action/FleetActionService.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 edit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function edit(Request $request, UserPasswordHasherInterface $passwordHasher): Response
                  {
                      $user = $this->getGameUser();
                      $changePasswordForm = $this->createForm(ChangePasswordType::class, $user);
                      $changePasswordForm->handleRequest($request);
              Severity: Minor
              Found in src/Controller/Game/UserController.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 generateWorldRegions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function generateWorldRegions(
                      WorldSector $worldSector,
                      array $map,
                      MapConfiguration $mapConfiguration
                  ): void {
              Severity: Minor
              Found in src/Service/WorldGeneratorService.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 research has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function research(): Response
                  {
                      $player = $this->getPlayer();
                      $ongoingResearch = $this->researchRepository->findOngoingByPlayer($player);
                      $unresearched = $this->researchRepository->findUnresearchedByPlayer($player);
              Severity: Minor
              Found in src/Controller/Game/ResearchController.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 remove has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function remove(Player $player): void
                  {
                      foreach ($player->getMarketItems() as $marketItem) {
                          $this->entityManager->remove($marketItem);
                      }
              Severity: Minor
              Found in src/Repository/Doctrine/DoctrinePlayerRepository.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 processSuccess has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function processSuccess(): void
                  {
                      $totalBuildings = 0;
                      foreach ($this->region->getWorldRegionUnits() as $worldRegionUnit) {
                          if ($worldRegionUnit->getGameUnit()->getGameUnitType()->getId() == GameUnitType::GAME_UNIT_TYPE_BUILDINGS) {
              Severity: Minor
              Found in src/Service/OperationEngine/OperationProcessor/MissileAttack.php - About 1 hr to fix

                Method edit has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function edit(Request $request, int $categoryId): Response
                    {
                        try {
                            $this->ensureForumEnabled();
                        } catch (ForumDisabledException) {
                Severity: Minor
                Found in src/Controller/Forum/CategoryController.php - About 1 hr to fix

                  Method edit has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function edit(Request $request, int $topicId): Response
                      {
                          try {
                              $this->ensureForumEnabled();
                          } catch (ForumDisabledException) {
                  Severity: Minor
                  Found in src/Controller/Forum/TopicController.php - About 1 hr to fix

                    Method removeGameUnits has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function removeGameUnits(Request $request, int $regionId, int $gameUnitTypeId): Response
                        {
                            try {
                                $worldRegion = $this->regionActionService->getWorldRegionByIdAndPlayer($regionId, $this->getPlayer());
                            } catch (WorldRegionNotFoundException $e) {
                    Severity: Minor
                    Found in src/Controller/Game/ConstructionController.php - About 1 hr to fix

                      Method research has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function research(): Response
                          {
                              $player = $this->getPlayer();
                              $ongoingResearch = $this->researchRepository->findOngoingByPlayer($player);
                              $unresearched = $this->researchRepository->findUnresearchedByPlayer($player);
                      Severity: Minor
                      Found in src/Controller/Game/ResearchController.php - About 1 hr to fix

                        Method edit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function edit(Request $request, UserPasswordHasherInterface $passwordHasher): Response
                            {
                                $user = $this->getGameUser();
                                $changePasswordForm = $this->createForm(ChangePasswordType::class, $user);
                                $changePasswordForm->handleRequest($request);
                        Severity: Minor
                        Found in src/Controller/Game/UserController.php - About 1 hr to fix

                          Method selectGameUnits has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function selectGameUnits(Request $request, int $regionId, int $operationId, int $playerRegionId): Response
                              {
                                  $player = $this->getPlayer();
                          
                                  try {
                          Severity: Minor
                          Found in src/Controller/Game/OperationController.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language