1 | <?php |
||
8 | class Card implements \JsonSerializable |
||
9 | { |
||
10 | use HasButtons; |
||
11 | |||
12 | /** @var array Payload */ |
||
13 | protected $payload = []; |
||
14 | |||
15 | /** |
||
16 | * Create a Card. |
||
17 | * |
||
18 | * @param string $title |
||
19 | * |
||
20 | * @return static |
||
21 | */ |
||
22 | public static function create($title = '') |
||
26 | |||
27 | /** |
||
28 | * Create Card constructor. |
||
29 | * |
||
30 | * @param string $title |
||
31 | * |
||
32 | * @throws CouldNotCreateCard |
||
33 | */ |
||
34 | public function __construct($title = '') |
||
38 | |||
39 | /** |
||
40 | * Set Button Title. |
||
41 | * |
||
42 | * @param $title |
||
43 | * |
||
44 | * @throws CouldNotCreateCard |
||
45 | * @return $this |
||
46 | */ |
||
47 | public function title($title) |
||
57 | |||
58 | /** |
||
59 | * Set Card Item Url. |
||
60 | * |
||
61 | * @param $itemUrl |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function url($itemUrl) |
||
71 | |||
72 | /** |
||
73 | * Set Card Image Url. |
||
74 | * |
||
75 | * @param $imageUrl Image ration should be 1.91:1 |
||
76 | * |
||
77 | * @return $this |
||
78 | */ |
||
79 | public function image($imageUrl) |
||
85 | |||
86 | /** |
||
87 | * Set Card Subtitle. |
||
88 | * |
||
89 | * @param $subtitle |
||
90 | * |
||
91 | * @throws CouldNotCreateCard |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function subtitle($subtitle) |
||
104 | |||
105 | /** |
||
106 | * Returns a payload for API request. |
||
107 | * |
||
108 | * @return array |
||
109 | * @throws CouldNotCreateCard |
||
110 | */ |
||
111 | public function toArray() |
||
119 | |||
120 | /** |
||
121 | * Convert the object into something JSON serializable. |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | public function jsonSerialize() |
||
129 | } |
||
130 |