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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 26
rs 10
c 1
b 0
f 0
wmc 5

2 Methods

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