| Conditions | 7 |
| Paths | 48 |
| Total Lines | 52 |
| Code Lines | 36 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 38 | public function __invoke(CreateGameServerCommand $command) |
||
| 39 | { |
||
| 40 | $server = new Server(); |
||
| 41 | |||
| 42 | $server->uuid = Str::orderedUuid()->toString(); |
||
| 43 | $server->uuid_short = Str::substr($server->uuid, 0, 8); |
||
| 44 | $server->ds_id = $command->dsId; |
||
| 45 | $server->name = $command->name; |
||
| 46 | $server->game_id = $command->gameId; |
||
| 47 | $server->game_mod_id = $command->gameModId; |
||
| 48 | $server->server_ip = $command->serverIp; |
||
| 49 | $server->server_port = $command->serverPort; |
||
| 50 | $server->query_port = $command->queryPort; |
||
| 51 | $server->rcon_port = $command->rconPort; |
||
| 52 | $server->su_user = $command->suUser; |
||
| 53 | |||
| 54 | $server->enabled = true; |
||
| 55 | $server->blocked = false; |
||
| 56 | |||
| 57 | if (empty($command->rcon)) { |
||
| 58 | $server->rcon = Str::random(self::DEFAULT_RCON_PASSWORD_LENGTH); |
||
| 59 | } else { |
||
| 60 | $server->rcon = $command->rcon; |
||
| 61 | } |
||
| 62 | |||
| 63 | $node = $this->nodeRepository->findById($command->dsId); |
||
| 64 | |||
| 65 | if (empty($command->startCommand)) { |
||
| 66 | $gameMod = $this->gameModRepository->getById($command->gameModId); |
||
| 67 | |||
| 68 | $server->start_command = |
||
| 69 | $node->isLinux() |
||
| 70 | ? $gameMod->default_start_cmd_linux |
||
| 71 | : $gameMod->default_start_cmd_windows; |
||
| 72 | } else { |
||
| 73 | $server->start_command = $command->startCommand; |
||
| 74 | } |
||
| 75 | |||
| 76 | if (empty($command->dir)) { |
||
| 77 | $server->dir = 'servers/' . $server->uuid; |
||
| 78 | } else { |
||
| 79 | $server->dir = $command->dir; |
||
| 80 | } |
||
| 81 | |||
| 82 | if ($command->install) { |
||
| 83 | $server->installed = false; |
||
| 84 | } |
||
| 85 | |||
| 86 | $this->serverRepository->save($server); |
||
| 87 | |||
| 88 | if ($command->install) { |
||
| 89 | $this->gdaemonTaskRepository->addServerInstall($server); |
||
| 90 | } |
||
| 93 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths