Streak does not seem to conform to the naming convention (Utils?$).
This check examines a number of code elements and verifies that they conform
to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties,
methods, parameters, interfaces, classes, exceptions and special methods.
Loading history...
15
{
16
/** @var array $streaks */
17
private static $streaks;
18
19
/**
20
* @param Player $player
21
*/
22
public static function init(Player $player): void
23
{
24
self::$streaks[$player->getXuid()] = 0;
25
}
26
27
/**
28
* @param Player $player
29
*
30
* @throws \ReflectionException
31
*/
32
public static function addStreak(Player $player): void
33
{
34
$event = new PlayerStreakEvent($player, self::getStreak($player) + 1);
35
$event->call();
36
if (!$event->isCancelled()) {
37
self::$streaks[$player->getXuid()] += 1;
38
}
39
}
40
41
/**
42
* @param Player $player
43
*
44
* @return int
45
*/
46
public static function getStreak(Player $player): int
47
{
48
return isset(self::$streaks[$player->getXuid()])
49
? self::$streaks[$player->getXuid()]
50
: 0;
51
}
52
53
/**
54
* @param Player $player
55
*/
56
public static function resetStreak(Player $player): void
57
{
58
self::$streaks[$player->getXuid()] = 0;
59
}
60
61
/**
62
* @param Player $player
63
*/
64
public static function unsetStreak(Player $player): void
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.