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 ( 5797ad...3faf69 )
by Dan
29s queued 24s
created

AllianceBankExemptProcessor   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 28
rs 10
c 1
b 0
f 0
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A build() 0 21 5
1
<?php declare(strict_types=1);
2
3
namespace Smr\Pages\Player\Bank;
4
5
use AbstractSmrPlayer;
6
use Smr\Database;
7
use Smr\Page\PlayerPageProcessor;
8
use Smr\Pages\Player\AllianceExemptAuthorize;
9
use Smr\Request;
10
11
class AllianceBankExemptProcessor extends PlayerPageProcessor {
12
13
	public function __construct(
14
		private readonly ?int $minTransactionID = null,
15
		private readonly ?int $maxTransactionID = null
16
	) {}
17
18
	public function build(AbstractSmrPlayer $player): never {
19
		$db = Database::getInstance();
20
21
		//only if we are coming from the bank screen do we unexempt selection first
22
		if ($this->minTransactionID !== null && $this->maxTransactionID !== null) {
23
			$db->write('UPDATE alliance_bank_transactions SET exempt = 0 WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND alliance_id = ' . $db->escapeNumber($player->getAllianceID()) . '
24
						AND transaction_id BETWEEN ' . $db->escapeNumber($this->minTransactionID) . ' AND ' . $db->escapeNumber($this->maxTransactionID));
25
		}
26
27
		if (Request::has('exempt')) {
28
			$trans_ids = array_keys(Request::getArray('exempt'));
29
			$db->write('UPDATE alliance_bank_transactions SET exempt = 1, request_exempt = 0 WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND alliance_id = ' . $db->escapeNumber($player->getAllianceID()) . '
30
						AND transaction_id IN (' . $db->escapeArray($trans_ids) . ')');
31
		}
32
33
		if ($this->minTransactionID !== null) {
34
			$container = new AllianceBank($player->getAllianceID());
35
		} else {
36
			$container = new AllianceExemptAuthorize();
37
		}
38
		$container->go();
39
	}
40
41
}
42