Total Complexity | 2 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | class MenuButtonType |
||
16 | { |
||
17 | use FillFromArrayTrait; |
||
18 | |||
19 | public const TYPE_COMMANDS = 'commands'; |
||
20 | public const TYPE_WEB_APP = 'web_app'; |
||
21 | public const TYPE_DEFAULT = 'default'; |
||
22 | |||
23 | /** |
||
24 | * Type of the button must be one of the list: commands, web_app, default |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | public $type; |
||
29 | |||
30 | /** |
||
31 | * Text on the button. Required for type 'web_app' |
||
32 | * |
||
33 | * @var string|null |
||
34 | */ |
||
35 | public $text; |
||
36 | |||
37 | /** |
||
38 | * Description of the Web App that will be launched when the user presses the button. Required for type 'web_app' |
||
39 | * |
||
40 | * @var WebAppInfoType|null |
||
41 | */ |
||
42 | public $webApp; |
||
43 | |||
44 | /** |
||
45 | * @param string $type |
||
46 | * @param array|null $data |
||
47 | * |
||
48 | * @throws BadArgumentException |
||
49 | * |
||
50 | * @return MenuButtonType |
||
51 | */ |
||
52 | public static function create(string $type, array $data = null): MenuButtonType |
||
63 |