Total Complexity | 6 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | abstract class GdaemonCommandsService |
||
16 | { |
||
17 | /** |
||
18 | * @var GdaemonCommands |
||
19 | */ |
||
20 | protected $gdaemonCommands; |
||
21 | |||
22 | /** |
||
23 | * GdaemonCommandsService constructor. |
||
24 | * |
||
25 | * @param GdaemonCommands $gdaemonCommands |
||
26 | */ |
||
27 | public function __construct(GdaemonCommands $gdaemonCommands) |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Setting up gdaemon commands configuration |
||
34 | * |
||
35 | * @param int|DedicatedServer |
||
36 | * @throws GameapException |
||
37 | */ |
||
38 | protected function configureGdaemon($ds) |
||
39 | { |
||
40 | if (is_int($ds)) { |
||
41 | $dedicatedServer = DedicatedServer::findOrFail($ds); |
||
42 | } else if ($ds instanceof DedicatedServer) { |
||
43 | $dedicatedServer = $ds; |
||
44 | } else { |
||
45 | throw new GameapException('Invalid type'); |
||
46 | } |
||
47 | |||
48 | $this->gdaemonCommands->setConfig( |
||
49 | $dedicatedServer->gdaemonSettings() |
||
50 | ); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param string $command |
||
55 | * @param array $codes |
||
56 | * @return string |
||
57 | */ |
||
58 | protected function replaceShortCodes(string $command, array $codes) |
||
65 | } |
||
66 | } |