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 ( 30fe2e...c58695 )
by Dan
04:45
created

DragPortProcessor::build()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 14
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 22
rs 9.7998
1
<?php declare(strict_types=1);
2
3
namespace Smr\Pages\Admin\UniGen;
4
5
use Smr\Page\AccountPageProcessor;
6
use Smr\Request;
7
use SmrAccount;
8
use SmrPort;
9
use SmrSector;
10
11
class DragPortProcessor extends AccountPageProcessor {
12
13
	public function __construct(
14
		private readonly int $gameID,
15
		private readonly int $galaxyID
16
	) {}
17
18
	public function build(SmrAccount $account): never {
19
		// Move a port from one sector to another
20
		$targetSectorID = Request::getInt('TargetSectorID');
21
		$origSectorID = Request::getInt('OrigSectorID');
22
		$targetSector = SmrSector::getSector($this->gameID, $targetSectorID);
23
24
		// Skip if target sector already has a port
25
		if (!$targetSector->hasPort()) {
26
			$oldPort = SmrPort::getPort($this->gameID, $origSectorID);
27
28
			$newPort = SmrPort::createPort($this->gameID, $targetSectorID);
29
			$newPort->setRaceID($oldPort->getRaceID());
30
			$newPort->setLevel($oldPort->getLevel());
31
			$newPort->setPortGoods($oldPort->getGoodTransactions());
32
			$newPort->setCreditsToDefault();
33
			$newPort->update();
34
35
			SmrPort::removePort($this->gameID, $origSectorID);
36
		}
37
38
		$container = new EditGalaxy($this->gameID, $this->galaxyID);
39
		$container->go();
40
	}
41
42
}
43