Total Complexity | 2 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | abstract class Button extends Component |
||
6 | { |
||
7 | protected int $index = 0; |
||
8 | protected array $parameters = []; |
||
9 | |||
10 | public function toArray(): array |
||
11 | { |
||
12 | return [ |
||
13 | 'type' => 'button', |
||
14 | 'sub_type' => $this->subType(), // quick_reply|url |
||
15 | 'index' => $this->index, |
||
16 | 'parameters' => $this->parameters |
||
17 | ]; |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * From the API |
||
22 | * Position index of the button. |
||
23 | * You can have up to 3 buttons using index values of 0 to 2. |
||
24 | * |
||
25 | * We don't do the validation. |
||
26 | * It's up to the user to follow this guideline |
||
27 | */ |
||
28 | public function setIndex(int $index){ |
||
30 | } |
||
31 | |||
32 | public abstract function subType(): string; |
||
33 | } |
||
34 |