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();
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);
}
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,
- 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 buildForm
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add(
'title',
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
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) {
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);
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();
- 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 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()) {
- 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 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);
- 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 generateWorldRegions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function generateWorldRegions(
WorldSector $worldSector,
array $map,
MapConfiguration $mapConfiguration
): void {
- 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 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);
- 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 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);
}
- 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 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) {
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) {
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) {
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) {
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);
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);
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 {