MCPcopy Create free account
hub / github.com/error311/FileRise / randomToken

Method randomToken

src/FileRise/Storage/SourceHealth.php:14–22  ·  view source on GitHub ↗
(int $len = 6)

Source from the content-addressed store, hash-verified

12final class SourceHealth
13{
14 private static function randomToken(int $len = 6): string
15 {
16 $size = max(4, $len);
17 try {
18 return substr(bin2hex(random_bytes($size)), 0, $size);
19 } catch (Throwable $e) {
20 return substr(md5((string)microtime(true) . ':' . (string)mt_rand()), 0, $size);
21 }
22 }
23
24 private static function joinPath(string $base, string $child): string
25 {

Callers 1

checkMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected