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 (#1494)
by Dan
08:06 queued 03:15
created

PaperDeleteProcessor::build()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 10
nc 3
nop 1
dl 0
loc 20
rs 9.9332
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Smr\Pages\Player\GalacticPost;
4
5
use AbstractSmrPlayer;
6
use Smr\Database;
7
use Smr\Page\PlayerPageProcessor;
8
use Smr\Request;
9
10
class PaperDeleteProcessor extends PlayerPageProcessor {
11
12
	public function __construct(
13
		private readonly int $paperID
14
	) {}
15
16
	public function build(AbstractSmrPlayer $player): never {
17
		$db = Database::getInstance();
18
		// Should we delete this paper?
19
		if (Request::get('action') == 'Yes') {
20
21
			// Should the articles associated with the paper be deleted as well?
22
			if (Request::get('delete_articles') == 'Yes') {
23
				$dbResult = $db->read('SELECT * FROM galactic_post_paper_content WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND paper_id = ' . $db->escapeNumber($this->paperID));
24
				foreach ($dbResult->records() as $dbRecord) {
25
					$db->write('DELETE FROM galactic_post_article WHERE article_id = ' . $db->escapeNumber($dbRecord->getInt('article_id')) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
26
				}
27
			}
28
29
			// Delete the paper and the article associations
30
			$db->write('DELETE FROM galactic_post_paper WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND paper_id = ' . $db->escapeNumber($this->paperID));
31
			$db->write('DELETE FROM galactic_post_paper_content WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND paper_id = ' . $db->escapeNumber($this->paperID));
32
		}
33
34
		$container = new EditorOptions();
35
		$container->go();
36
	}
37
38
}
39