Total Complexity | 6 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
19 | class Item |
||
20 | { |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | public $thumbnail; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | public $text; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | public $title; |
||
35 | |||
36 | /** |
||
37 | * @var Action[] |
||
38 | */ |
||
39 | public $actions; |
||
40 | |||
41 | public function __construct($title, $text, $thumbnail, array $actions = []) |
||
42 | { |
||
43 | $this->title = $title; |
||
44 | $this->text = $text; |
||
45 | $this->thumbnail = $thumbnail; |
||
46 | |||
47 | foreach ($actions as $action) { |
||
48 | if (!$action instanceof Action) { |
||
49 | throw new \InvalidArgumentException("`Action` should be typeof: ".Action::class); |
||
50 | } |
||
51 | |||
52 | $this->actions[] = $action; |
||
53 | } |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @param $label |
||
58 | * @param $text |
||
59 | */ |
||
60 | public function addMessageAction($label, $text) |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * @param $label |
||
67 | * @param $link |
||
68 | */ |
||
69 | public function addUriAction($label, $link) |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param $label |
||
76 | * @param $data |
||
77 | */ |
||
78 | public function addPostbackAction($label, $data) |
||
83 |