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