Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Failed Conditions
Push — main ( d9cfb9...10f5c7 )
by Dan
32s queued 21s
created

Headquarters/BountyPlaceConfirmProcessor.php (2 issues)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
namespace Smr\Pages\Player\Headquarters;
4
5
use AbstractSmrPlayer;
6
use Exception;
7
use Smr\BountyType;
8
use Smr\Page\PlayerPageProcessor;
9
use Smr\Request;
10
use SmrLocation;
11
use SmrPlayer;
12
13
class BountyPlaceConfirmProcessor extends PlayerPageProcessor {
14
15
	public function __construct(
16
		private readonly int $locationID,
17
		private readonly int $otherAccountID,
18
		private readonly int $credits,
19
		private readonly int $smrCredits
20
	) {}
21
22
	public function build(AbstractSmrPlayer $player): never {
23
		if (!$player->getSector()->hasLocation($this->locationID)) {
24
			create_error('That location does not exist in this sector');
25
		}
26
27
		$location = SmrLocation::getLocation($player->getGameID(), $this->locationID);
28
29
		[$type, $body] = match (true) {
30
			$location->isHQ() => [BountyType::HQ, Government::class],
31
			$location->isUG() => [BountyType::UG, Underground::class],
32
			default => throw new Exception('Location is not HQ or UG'),
33
		};
34
		$container = new $body($this->locationID);
35
36
		// if we don't have a yes we leave immediatly
37
		if (Request::get('action') != 'Yes') {
38
			$container->go();
39
		}
40
41
		// get values from container (validated in bounty_place_processing.php)
42
		$amount = $this->credits;
43
		$smrCredits = $this->smrCredits;
44
		$account_id = $this->otherAccountID;
45
46
		// take the bounty from the cash
47
		$player->decreaseCredits($amount);
48
		$player->getAccount()->decreaseSmrCredits($smrCredits);
49
50
		$player->increaseHOF($smrCredits, ['Bounties', 'Placed', 'SMR Credits'], HOF_PUBLIC);
51
		$player->increaseHOF($amount, ['Bounties', 'Placed', 'Money'], HOF_PUBLIC);
52
		$player->increaseHOF(1, ['Bounties', 'Placed', 'Number'], HOF_PUBLIC);
53
54
		$placed = SmrPlayer::getPlayer($account_id, $player->getGameID());
55
		$placed->increaseCurrentBountyAmount($type, $amount);
0 ignored issues
show
$amount of type double is incompatible with the type integer expected by parameter $amount of AbstractSmrPlayer::increaseCurrentBountyAmount(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

55
		$placed->increaseCurrentBountyAmount($type, /** @scrutinizer ignore-type */ $amount);
Loading history...
56
		$placed->increaseCurrentBountySmrCredits($type, $smrCredits);
0 ignored issues
show
$smrCredits of type double is incompatible with the type integer expected by parameter $credits of AbstractSmrPlayer::incre...rrentBountySmrCredits(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

56
		$placed->increaseCurrentBountySmrCredits($type, /** @scrutinizer ignore-type */ $smrCredits);
Loading history...
57
		$placed->increaseHOF($smrCredits, ['Bounties', 'Received', 'SMR Credits'], HOF_PUBLIC);
58
		$placed->increaseHOF($amount, ['Bounties', 'Received', 'Money'], HOF_PUBLIC);
59
		$placed->increaseHOF(1, ['Bounties', 'Received', 'Number'], HOF_PUBLIC);
60
61
		//Update for top bounties list
62
		$player->update();
63
		$player->getAccount()->update();
64
		$placed->update();
65
		$container->go();
66
	}
67
68
}
69