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

Passed
Push — main ( 6eb332...15a06a )
by Dan
07:01
created

CallbackEvent::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Smr\Irc;
4
5
use Closure;
6
7
/**
8
 * Manage callback events in the IRC driver.
9
 *
10
 * Some of the IRC listeners have to make queries to the IRC server before
11
 * continuing with processing, and this class stores the callback for those
12
 * queries so we can proceed once the server responds.
13
 */
14
class CallbackEvent {
15
16
	/** @var array<self> */
17
	private static array $EVENTS;
18
19
	/**
20
	 * @return array<self>
21
	 */
22
	public static function getAll(): array {
23
		return self::$EVENTS;
24
	}
25
26
	public static function add(self $eventToAdd): void {
27
		self::$EVENTS[] = $eventToAdd;
28
	}
29
30
	public static function remove(self $eventToRemove): void {
31
		foreach (self::$EVENTS as $key => $event) {
32
			if ($event === $eventToRemove) {
33
				unset(self::$EVENTS[$key]);
34
				break;
35
			}
36
		}
37
	}
38
39
	public function __construct(
40
		public readonly string $type,
41
		public readonly string $channel,
42
		public readonly string $nick,
43
		public readonly Closure $callback,
44
		public readonly int $time,
45
		public readonly bool $validate
46
	) {}
47
48
}
49