15declare(strict_types=1);
17namespace raklib\generic;
20 public const CLIENT_DISCONNECT = 0;
21 public const SERVER_DISCONNECT = 1;
22 public const PEER_TIMEOUT = 2;
23 public const CLIENT_RECONNECT = 3;
24 public const SERVER_SHUTDOWN = 4;
26 public static function toString(
int $reason) :
string{
27 return match($reason){
28 self::CLIENT_DISCONNECT =>
"client disconnect",
29 self::SERVER_DISCONNECT =>
"server disconnect",
30 self::PEER_TIMEOUT =>
"timeout",
31 self::CLIENT_RECONNECT =>
"new session established on same address and port",
32 self::SERVER_SHUTDOWN =>
"server shutdown",
33 default =>
"Unknown reason $reason"