Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public static function make(array $data, string $bot_username): Entity |
||
11 | { |
||
12 | $type = [ |
||
13 | 'commands' => MenuButtonCommands::class, |
||
14 | 'web_app' => MenuButtonWebApp::class, |
||
15 | 'default' => MenuButtonDefault::class, |
||
16 | ]; |
||
17 | |||
18 | if (! isset($type[$data['type'] ?? ''])) { |
||
19 | return new MenuButtonNotImplemented($data, $bot_username); |
||
20 | } |
||
21 | |||
22 | $class = $type[$data['type']]; |
||
23 | return new $class($data, $bot_username); |
||
24 | } |
||
26 |