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 — master (#1018)
by Dan
04:32
created

DummyShip::enableCloak()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
class DummyShip extends AbstractSmrShip {
4
	protected static $CACHED_DUMMY_SHIPS;
5
6
	public function __construct(AbstractSmrPlayer $player) {
7
		parent::__construct($player);
8
		$this->setHardwareToMax();
9
	}
10
11
	public function cacheDummyShip() {
12
		$cache = serialize($this);
13
		$db = MySqlDatabase::getInstance();
14
		$db->query('REPLACE INTO cached_dummys (type, id, info)
15
					VALUES (\'DummyShip\', ' . $db->escapeString($this->getPlayer()->getPlayerName()) . ', ' . $db->escapeString($cache) . ')');
16
	}
17
18
	public static function getCachedDummyShip(AbstractSmrPlayer $player) {
19
		if (!isset(self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()])) {
20
			$ship = new DummyShip($player);
21
22
			// Load weapons from the dummy database cache, if available
23
			$db = MySqlDatabase::getInstance();
24
			$db->query('SELECT info FROM cached_dummys WHERE type = \'DummyShip\'
25
						AND id = ' . $db->escapeString($player->getPlayerName()) . ' LIMIT 1');
26
			if ($db->nextRecord()) {
27
				$cachedShip = unserialize($db->getField('info'));
28
				foreach ($cachedShip->getWeapons() as $weapon) {
29
					$ship->addWeapon($weapon);
30
				}
31
			}
32
33
			self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] = $ship;
34
		}
35
		return self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()];
36
	}
37
38
	public static function getDummyShipNames() {
39
		$db = MySqlDatabase::getInstance();
40
		$db->query('SELECT id FROM cached_dummys WHERE type = \'DummyShip\'');
41
		$dummyNames = array();
42
		while ($db->nextRecord()) {
43
			$dummyNames[] = $db->getField('id');
44
		}
45
		return $dummyNames;
46
	}
47
48
	public function __sleep() {
49
		return array('weapons');
50
	}
51
52
}
53