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

Issues (412)

src/lib/Smr/UserRanking.php (8 issues)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
namespace Smr;
4
5
/**
6
 * User ranking titles
7
 */
8
enum UserRanking: int {
9
10
	// Backing values map to database values and must not be changed
11
	case Newbie = 1;
12
	case Beginner = 2;
13
	case Fledgling = 3;
14
	case Average = 4;
15
	case Adept = 5;
16
	case Expert = 6;
17
	case Elite = 7;
18
	case Master = 8;
19
	case Grandmaster = 9;
20
21
	public const MIN_RANK = 1;
22
	public const MAX_RANK = 9;
23
24
	public const SCORE_POW = .3;
25
	public const SCORE_POW_RANK_INCREMENT = 5.2;
26
27
	/**
28
	 * Given a score, return the associated rank
29
	 */
30
	public static function getRankFromScore(int $score): self {
31
		$rank = ICeil(pow($score, self::SCORE_POW) / self::SCORE_POW_RANK_INCREMENT);
0 ignored issues
show
The function ICeil was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
		$rank = /** @scrutinizer ignore-call */ ICeil(pow($score, self::SCORE_POW) / self::SCORE_POW_RANK_INCREMENT);
Loading history...
The constant Smr\UserRanking::SCORE_POW was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant Smr\UserRanking::SCORE_POW_RANK_INCREMENT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
32
		$rank = min(max($rank, self::MIN_RANK), self::MAX_RANK);
0 ignored issues
show
The constant Smr\UserRanking::MIN_RANK was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant Smr\UserRanking::MAX_RANK was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
33
		return self::from($rank);
34
	}
35
36
	/**
37
	 * Given a rank, return the minimum score needed to achieve it
38
	 * (this is an inversion of getRankFromScore)
39
	 */
40
	public function getMinScore(): int {
41
		return ICeil(pow(($this->value - 1) * self::SCORE_POW_RANK_INCREMENT, 1 / self::SCORE_POW));
0 ignored issues
show
The function ICeil was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
		return /** @scrutinizer ignore-call */ ICeil(pow(($this->value - 1) * self::SCORE_POW_RANK_INCREMENT, 1 / self::SCORE_POW));
Loading history...
The constant Smr\UserRanking::SCORE_POW was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant Smr\UserRanking::SCORE_POW_RANK_INCREMENT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
42
	}
43
44
}
45