1 | <?php |
||
7 | class Attachment implements \JsonSerializable |
||
8 | { |
||
9 | const TYPE_IMAGE = 'image'; |
||
10 | const TYPE_FILE = 'file'; |
||
11 | |||
12 | const TYPE_TEMPLATE = 'template'; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $type; |
||
18 | |||
19 | /** |
||
20 | * @var array|Template |
||
21 | */ |
||
22 | private $payload; |
||
23 | |||
24 | /** |
||
25 | * Attachment constructor. |
||
26 | * |
||
27 | * @param $type |
||
28 | * @param array|Template $payload |
||
29 | */ |
||
30 | 17 | public function __construct($type, $payload = []) |
|
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | 4 | public function getType() |
|
43 | |||
44 | /** |
||
45 | * @return array|Template |
||
46 | */ |
||
47 | 3 | public function getPayload() |
|
51 | |||
52 | /** |
||
53 | * @return array |
||
54 | */ |
||
55 | 1 | public function jsonSerialize() |
|
62 | } |
||
63 |