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
Pull Request — main (#1498)
by Dan
04:47
created

DragPortProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 29
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 22 2
A __construct() 0 4 1
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