| 1 | <?php |
||
| 5 | abstract class QuickReply implements \JsonSerializable |
||
| 6 | { |
||
| 7 | const TYPE_TEXT = 'text'; |
||
| 8 | const TYPE_LOCATION = 'location'; |
||
| 9 | const TYPE_USER_PHONE_NUMBER = 'user_phone_number'; |
||
| 10 | const TYPE_USER_EMAIL = 'user_email'; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | private $contentType; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param string $contentType TYPE_* |
||
| 19 | */ |
||
| 20 | 21 | public function __construct($contentType) |
|
| 21 | { |
||
| 22 | 21 | $this->contentType = $contentType; |
|
| 23 | 21 | } |
|
| 24 | |||
| 25 | /** |
||
| 26 | * @return string |
||
| 27 | */ |
||
| 28 | 4 | public function getContentType() |
|
| 29 | { |
||
| 30 | 4 | return $this->contentType; |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @inheritdoc |
||
| 35 | */ |
||
| 36 | 5 | public function jsonSerialize() |
|
| 37 | { |
||
| 38 | return [ |
||
| 39 | 5 | 'content_type' => $this->contentType, |
|
| 40 | 5 | ]; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param string $title |
||
| 45 | * |
||
| 46 | * @throws \InvalidArgumentException |
||
| 47 | */ |
||
| 48 | 9 | public static function validateTitleSize($title) |
|
| 54 | |||
| 55 | /** |
||
| 56 | * @param $payload |
||
| 57 | * |
||
| 58 | * @throws \InvalidArgumentException |
||
| 59 | */ |
||
| 60 | 8 | public static function validatePayload($payload) |
|
| 66 | } |
||
| 67 |