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

ServerStatusProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 20 3
1
<?php declare(strict_types=1);
2
3
namespace Smr\Pages\Admin;
4
5
use Exception;
6
use Smr\Database;
7
use Smr\Page\AccountPageProcessor;
8
use Smr\Request;
9
use SmrAccount;
10
11
class ServerStatusProcessor extends AccountPageProcessor {
12
13
	public function build(SmrAccount $account): never {
14
		$db = Database::getInstance();
15
16
		$action = Request::get('action');
17
		if ($action == 'Close') {
18
			$reason = Request::get('close_reason');
19
			$db->replace('game_disable', [
20
				'reason' => $db->escapeString($reason),
21
			]);
22
			$db->write('DELETE FROM active_session;');
23
			$msg = '<span class="green">SUCCESS: </span>You have closed the server. You will now be logged out!';
24
		} elseif ($action == 'Open') {
25
			$db->write('DELETE FROM game_disable;');
26
			$msg = '<span class="green">SUCCESS: </span>You have opened the server.';
27
		} else {
28
			throw new Exception('Unknown action: ' . $action);
29
		}
30
31
		$container = new AdminTools($msg);
32
		$container->go();
33
	}
34
35
}
36