Showing 103 of 141 total issues
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 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);
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) {
- 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 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) {
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) {
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();
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) {
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)
*/
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) {
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()) {
Method buildForm
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add(
'attack',
Method buildForm
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add(
'oldPassword',
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) {
Method executeOperation
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function executeOperation(
WorldRegion $region,
Operation $operation,
WorldRegion $playerRegion,
int $amount
Method buildForm
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add(
'cash',
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 == '') {
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
- 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 removeGameUnits
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function removeGameUnits(
WorldRegion $region,
Player $player,
GameUnitType $gameUnitType,
array $destroyData
- 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 octave
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function octave(int $size, float $persistence, int $octave): void
{
$freq = pow(2, $octave);
$amp = pow($persistence, $octave);
Method ensureCanExecute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function ensureCanExecute(
WorldRegion $region,
Operation $operation,
WorldRegion $playerRegion,
int $amount