FrankProjects/UltimateWarfare

View on GitHub

Showing 141 of 141 total issues

Method withdraw has 33 lines of code (exceeds 25 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

    Method requestPasswordReset has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function requestPasswordReset(Request $request): Response
        {
            $email = (string) $request->request->get('email');
            if ($email !== '') {
                $user = $this->userRepository->findByEmail($email);
    Severity: Minor
    Found in src/Controller/Site/ResetPasswordController.php - About 1 hr to fix

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

          public function deposit(Player $player, array $resources): void
          {
              $this->ensureFederationEnabled($player);
              $federation = $player->getFederation();
              if ($federation === null) {
      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

      Method searchPlayer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function searchPlayer(Request $request): Response
          {
              $playerName = (string) $request->request->get('playerName');
              $player = $this->getPlayer();
              $world = $player->getWorld();
      Severity: Minor
      Found in src/Controller/Game/WorldController.php - About 1 hr to fix

        Method kickPlayer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method create has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public function forumUnban(int $userId): RedirectResponse
                {
                    $user = $this->getUserObject($userId);
                    if (!$user->getForumBan()) {
                        $this->addFlash('error', 'User is not forum banned');
            Severity: Major
            Found in src/Controller/Admin/UserController.php and 1 other location - About 1 hr to fix
            src/Controller/Admin/UserController.php on lines 30..42

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public function remove(int $contactId): RedirectResponse
                {
                    $contact = $this->contactRepository->find($contactId);
                    if ($contact === null) {
                        $this->addFlash('error', 'Contact does not exist');
            Severity: Major
            Found in src/Controller/Admin/ContactController.php and 2 other locations - About 1 hr to fix
            src/Controller/Admin/GameNewsController.php on lines 79..90
            src/Controller/Admin/UnbanRequestController.php on lines 36..47

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public function remove(int $gameNewsId): RedirectResponse
                {
                    $gameNews = $this->gameNewsRepository->find($gameNewsId);
                    if ($gameNews === null) {
                        $this->addFlash('error', 'GameNews does not exist');
            Severity: Major
            Found in src/Controller/Admin/GameNewsController.php and 2 other locations - About 1 hr to fix
            src/Controller/Admin/ContactController.php on lines 42..53
            src/Controller/Admin/UnbanRequestController.php on lines 36..47

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    try {
                        $worldRegion = $this->regionActionService->getWorldRegionByIdAndWorld($regionId, $player->getWorld());
                        $playerRegions = $this->regionActionService->getAttackFromWorldRegionList($worldRegion, $this->getPlayer());
                    } catch (WorldRegionNotFoundException $e) {
                        $this->addFlash('error', $e->getMessage());
            Severity: Major
            Found in src/Controller/Game/AttackController.php and 1 other location - About 1 hr to fix
            src/Controller/Game/OperationController.php on lines 54..62

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                public function remove(int $unbanRequestId): RedirectResponse
                {
                    $unbanRequest = $this->unbanRequestRepository->find($unbanRequestId);
                    if ($unbanRequest === null) {
                        $this->addFlash('error', 'UnbanRequest does not exist');
            Severity: Major
            Found in src/Controller/Admin/UnbanRequestController.php and 2 other locations - About 1 hr to fix
            src/Controller/Admin/ContactController.php on lines 42..53
            src/Controller/Admin/GameNewsController.php on lines 79..90

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    try {
                        $worldRegion = $this->regionActionService->getWorldRegionByIdAndWorld($regionId, $player->getWorld());
                        $playerRegions = $this->regionActionService->getOperationAttackFromWorldRegionList($worldRegion, $this->getPlayer());
                    } catch (WorldRegionNotFoundException $e) {
                        $this->addFlash('error', $e->getMessage());
            Severity: Major
            Found in src/Controller/Game/OperationController.php and 1 other location - About 1 hr to fix
            src/Controller/Game/AttackController.php on lines 43..51

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public function ban(int $userId): RedirectResponse
                {
                    $user = $this->getUserObject($userId);
                    if (!$user->getActive()) {
                        $this->addFlash('error', 'User is already banned');
            Severity: Major
            Found in src/Controller/Admin/UserController.php and 1 other location - About 1 hr to fix
            src/Controller/Admin/UserController.php on lines 87..99

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 105.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

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

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

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

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

                    public function regionList(): Response
                    {
                        /**
                         * XXX TODO: Add sorting support (by building space, population, buildings, units)
                         */
                Severity: Minor
                Found in src/Controller/Game/RegionController.php - About 1 hr to fix

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

                      public function executeOperation(
                          WorldRegion $region,
                          Operation $operation,
                          WorldRegion $playerRegion,
                          int $amount
                  Severity: Minor
                  Found in src/Service/OperationService.php - About 1 hr to fix

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

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

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

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

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

                            public function placeOffer(Request $request): Response
                            {
                                $player = $this->getPlayer();
                                $world = $player->getWorld();
                                if (!$world->getMarket()) {
                        Severity: Minor
                        Found in src/Controller/Game/MarketController.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language