FrankProjects/UltimateWarfare

View on GitHub

Showing 103 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

            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

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

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

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

                                public function topic(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 newMessage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function newMessage(Request $request, string $playerName = ''): Response
                                  {
                                      $player = $this->getPlayer();
                              
                                      if ($playerName == '') {
                              Severity: Minor
                              Found in src/Controller/Game/MessageController.php - About 1 hr to fix

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

                                    private function ensureCanExecute(
                                        WorldRegion $region,
                                        Operation $operation,
                                        WorldRegion $playerRegion,
                                        int $amount
                                Severity: Minor
                                Found in src/Service/OperationService.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 removeGameUnits has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function removeGameUnits(
                                        WorldRegion $region,
                                        Player $player,
                                        GameUnitType $gameUnitType,
                                        array $destroyData
                                Severity: Minor
                                Found in src/Service/Action/ConstructionActionService.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 ensureCanExecute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

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

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

                                      public function sector(int $sectorId): Response
                                      {
                                          $player = $this->getPlayer();
                                          $sector = $this->worldSectorRepository->findByIdAndWorld($sectorId, $player->getWorld());
                                  
                                  
                                  Severity: Minor
                                  Found in src/Controller/Game/SectorController.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language