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   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 33
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A remove() 0 5 3
A getAll() 0 2 1
A __construct() 0 8 1
A add() 0 2 1
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