@@ -28,9 +28,9 @@ final class Config implements Singleton, FromContext, ConfigInterface {
28
28
use SingletonArgs, SingletonTrait, ConfigTrait;
29
29
30
30
/**
31
- * @param array<string, PlayerInfosManager > $singleQueries
31
+ * @param array<string, Single\PlayerInfoUpdater > $singleQueries
32
32
* @param array<string, PlayerInfoCommand> $infoCommands
33
- * @param list<ConfigTop > $topQueries
33
+ * @param list<Top\Config > $topQueries
34
34
*/
35
35
public function __construct (
36
36
public array $ singleQueries ,
@@ -102,7 +102,7 @@ public static function parse(Parser $config, Context $di, Raw $raw) : Generator
102
102
103
103
foreach ($ topPlayersConfig ->getKeys () as $ key ) {
104
104
$ queryConfig = $ topPlayersConfig ->enter ($ key , null );
105
- $ topQueries [] = self :: parseTopPlayerQuery ($ queryConfig , $ schema , $ key );
105
+ $ topQueries [] = Top \Config:: parse ($ queryConfig , $ schema , $ key );
106
106
}
107
107
108
108
return new self (
@@ -112,7 +112,7 @@ public static function parse(Parser $config, Context $di, Raw $raw) : Generator
112
112
);
113
113
}
114
114
115
- private static function parseSingleQuery (Parser $ infoConfig , Schema \Schema $ schema , string $ infoName ) : PlayerInfosManager {
115
+ private static function parseSingleQuery (Parser $ infoConfig , Schema \Schema $ schema , string $ infoName ) : Single \ PlayerInfoUpdater {
116
116
$ type = $ infoConfig ->expectString ("of " , "account " , <<<'EOT'
117
117
The data source of this info.
118
118
If set to "account", the info is calculated from statistics of some of the player's accounts.
@@ -128,7 +128,7 @@ private static function parseSingleQuery(Parser $infoConfig, Schema\Schema $sche
128
128
129
129
$ metric = AccountQueryMetric::parseConfig ($ infoConfig , "metric " );
130
130
131
- $ query = new AccountSingleQuery ($ metric , fn (Player $ player ) => $ infoSchema ->getSelector ($ player ));
131
+ $ query = new Single \ AccountQuery ($ metric , fn (Player $ player ) => $ infoSchema ->getSelector ($ player ));
132
132
} elseif ($ type === "transaction " ) {
133
133
$ selectorConfig = $ infoConfig ->enter ("selector " , "Filter transactions by labels " );
134
134
$ labels = [];
@@ -139,7 +139,7 @@ private static function parseSingleQuery(Parser $infoConfig, Schema\Schema $sche
139
139
140
140
$ metric = TransactionQueryMetric::parseConfig ($ infoConfig , "metric " );
141
141
142
- $ query = new TransactionSingleQuery ($ metric , fn (Player $ player ) => $ labels ->transform (new PlayerInfo ($ player )));
142
+ $ query = new Single \ TransactionQuery ($ metric , fn (Player $ player ) => $ labels ->transform (new PlayerInfo ($ player )));
143
143
} else {
144
144
throw new AssertionError ("unreachable code " );
145
145
}
@@ -149,7 +149,7 @@ private static function parseSingleQuery(Parser $infoConfig, Schema\Schema $sche
149
149
This will only affect displays and will not affect transactions.
150
150
EOT) * 20. );
151
151
152
- return new PlayerInfosManager ($ infoName , new CachedSingleQuery ($ query , $ updateFrequencyTicks ));
152
+ return new Single \ PlayerInfoUpdater ($ infoName , new Single \ Cached ($ query , $ updateFrequencyTicks ));
153
153
}
154
154
155
155
private static function parseInfoCommand (Parser $ config , string $ cmdName ) : PlayerInfoCommand {
@@ -164,32 +164,4 @@ private static function parseInfoCommand(Parser $config, string $cmdName) : Play
164
164
165
165
return new PlayerInfoCommand ($ command , $ template );
166
166
}
167
-
168
- private static function parseTopPlayerQuery (Parser $ infoConfig , Schema \Schema $ schema , string $ cmdName ) : ConfigTop {
169
- $ cmdConfig = $ infoConfig ->enter ("command " , "The command that displays the information. " );
170
- $ command = DynamicCommand::parse ($ cmdConfig , "analytics.top " , $ cmdName , "Displays the richest player " , false );
171
-
172
- $ queryArgs = TopQueryArgs::parse ($ infoConfig , $ schema );
173
-
174
- $ refreshConfig = $ infoConfig ->enter ("refresh " , <<<'EOT'
175
- Refresh settings for the top query.
176
- These settings depend on how many active accounts you have in the database
177
- as well as how powerful the CPU of your database server is.
178
- Try increasing the frequencies and reducing batch size if the database server is lagging.
179
- EOT);
180
- $ refreshArgs = TopRefreshArgs::parse ($ refreshConfig );
181
-
182
- $ paginationConfig = $ infoConfig ->enter ("pagination " , <<<'EOT'
183
- Pagination settings for the top query.
184
- EOT);
185
- $ paginationArgs = TopPaginationArgs::parse ($ paginationConfig );
186
-
187
- return new ConfigTop (
188
- command: $ command ,
189
- queryArgs: $ queryArgs ,
190
- refreshArgs: $ refreshArgs ,
191
- paginationArgs: $ paginationArgs ,
192
- messages: TopMessages::parse ($ infoConfig ->enter ("messages " , "Configures the displayed messages " )),
193
- );
194
- }
195
167
}
0 commit comments