Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
85.71% |
6 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
Token | |
85.71% |
6 / 7 |
|
0.00% |
0 / 1 |
4.05 | |
0.00% |
0 / 1 |
generate | |
85.71% |
6 / 7 |
|
0.00% |
0 / 1 |
4.05 |
1 | <?php |
2 | |
3 | class Token { |
4 | static array $staticTokens = []; |
5 | static function generate(string $type, string $name): string { |
6 | if (SystemConfig::$debug_useStaticTokens) { |
7 | |
8 | if (isset(self::$staticTokens[$name])) { |
9 | self::$staticTokens[$name]++; |
10 | } else { |
11 | self::$staticTokens[$name] = 0; |
12 | } |
13 | |
14 | $suffix = self::$staticTokens[$name] ? ':' . (self::$staticTokens[$name] + 1) : ''; |
15 | |
16 | return substr("static:$type:$name", 0, 50 - strlen($suffix)) . $suffix; |
17 | } |
18 | |
19 | return Random::string(24, true); |
20 | } |
21 | } |