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