Showing 103 of 141 total issues
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());
Method selectWorldRegion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function selectWorldRegion(int $regionId, int $operationId): Response
{
$player = $this->getPlayer();
$playerRegions = [];
$worldRegion = null;
Method selectOperation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function selectOperation(Request $request, int $regionId): Response
{
$player = $this->getPlayer();
try {
Function showLogs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function showLogs(): Response
{
$finder = new Finder();
$finder->in($this->getParameter('kernel.project_dir') . '/var/log');
$finder->name('*.log');
- Read upRead up
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 ensureCanResearch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function ensureCanResearch(Research $research, Player $player): void
{
$researchArray = [];
/** @var ResearchPlayer $playerResearch */
- Read upRead up
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 __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
ReportCreator $reportCreator,
NetworthUpdaterService $networthUpdaterService,
IncomeUpdaterService $incomeUpdaterService,
PlayerRepository $playerRepository,
WorldRegionUnitRepository $worldRegionUnitRepository,
Function generateWorldSectors
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function generateWorldSectors(
World $world,
array $map,
MapConfiguration $mapConfiguration,
int $sector
- Read upRead up
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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ConstructionRepository $constructionRepository,
GameUnitRepository $gameUnitRepository,
PlayerRepository $playerRepository,
WorldRegionUnitRepository $worldRegionUnitRepository,
NetworthUpdaterService $networthUpdaterService
Method placeOffer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function placeOffer(Player $player, string $gameResource, int $price, int $amount, string $action): void
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
OperationRepository $operationRepository,
WorldRegionRepository $worldRegionRepository,
GameUnitTypeRepository $gameUnitTypeRepository,
RegionActionService $regionActionService,
OperationService $operationService
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
WorldRegionRepository $worldRegionRepository,
PlayerRepository $playerRepository,
FederationRepository $federationRepository,
DistanceCalculator $distanceCalculator,
TimeCalculator $timeCalculator
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ConstructionRepository $constructionRepository,
PlayerRepository $playerRepository,
ReportRepository $reportRepository,
WorldRegionUnitRepository $worldRegionUnitRepository,
NetworthUpdaterService $networthUpdaterService
Method sendGameUnits
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
WorldRegion $region,
WorldRegion $targetRegion,
Player $player,
GameUnitType $gameUnitType,
array $unitData
Method sendMessage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Player $player,
string $subject,
string $message,
string $toPlayerName,
bool $adminMessage
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
FederationRepository $federationRepository,
FederationApplicationRepository $federationApplicationRepository,
FederationNewsRepository $federationNewsRepository,
PlayerRepository $playerRepository,
ReportRepository $reportRepository
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
WorldRepository $worldRepository,
WorldRegionRepository $worldRegionRepository,
WorldSectorRepository $worldSectorRepository,
PerlinNoiseGenerator $worldGenerator,
WorldImageGeneratorService $worldImageGeneratorService
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ConstructionRepository $constructionRepository,
GameUnitTypeRepository $gameUnitTypeRepository,
WorldRegionRepository $worldRegionRepository,
ConstructionActionService $constructionActionService,
RegionActionService $regionActionService
Function generateForWorldSector
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function generateForWorldSector(WorldSector $worldSector, string $path): void
{
$worldSectorRegionsCount = count($worldSector->getWorldRegions());
$size = (int)sqrt($worldSectorRegionsCount) * 25;
if ($size === 0) {
- Read upRead up
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 uploadAvatar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function uploadAvatar(Request $request): Response
{
$user = $this->getGameUser();
$form = $this->createForm(UploadAvatarType::class);
$form->handleRequest($request);
- Read upRead up
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 hasWorldRegionGameUnitAmount
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function hasWorldRegionGameUnitAmount(WorldRegion $region, Operation $operation, int $amount): void
{
if ($amount < 1) {
throw new RuntimeException("Can not send negative game units");
}
- Read upRead up
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"