Initial commit: 投注游戏平台初始化
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\Core;
|
||||
|
||||
class GameFactory {
|
||||
private static $map = [
|
||||
'pk10' => PK10Algorithm::class,
|
||||
'dice' => DiceAlgorithm::class,
|
||||
'xocdia' => XocDiaAlgorithm::class,
|
||||
];
|
||||
|
||||
public static function getAlgorithm(string $gameType): string {
|
||||
$class = self::$map[$gameType] ?? null;
|
||||
if (!$class) throw new \RuntimeException("Unknown game type: {$gameType}");
|
||||
return $class;
|
||||
}
|
||||
|
||||
public static function register(string $gameType, string $class): void {
|
||||
self::$map[$gameType] = $class;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user