1 | <?php |
||
8 | class FlockAttachmentView |
||
9 | { |
||
10 | /** |
||
11 | * Displays an attachment widget inside the chat screen in desktop, |
||
12 | * or pops up a modal when the attachment is opened on mobile. |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | public $widget; |
||
17 | |||
18 | /** |
||
19 | * Displays the HTML string inside the chat screen in desktop (using an iframe). |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | public $html; |
||
24 | |||
25 | /** |
||
26 | * A string containing FlockML content. It is displayed inside the chat screen on both desktop and mobile. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | public $flockml; |
||
31 | |||
32 | /** |
||
33 | * An image for the attachment. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | public $image; |
||
38 | |||
39 | /** |
||
40 | * Create an widget. |
||
41 | * |
||
42 | * @param string $src |
||
43 | * @param int|null $height |
||
44 | * @param int|null $width |
||
45 | * |
||
46 | * @return $this |
||
47 | */ |
||
48 | public function widget($src, $height = null, $width = null) |
||
49 | { |
||
50 | if (! filter_var($src, FILTER_VALIDATE_URL)) { |
||
51 | throw CouldNotSendNotification::flockAttachmentViewWidgetException('Source of widget in attachment is missing or invalid.'); |
||
52 | } |
||
53 | $this->widget['src'] = $src; |
||
54 | |||
55 | if (! filter_var($height, FILTER_VALIDATE_INT) || $height <= 0) { |
||
56 | throw CouldNotSendNotification::flockAttachmentViewWidgetException('Height of widget in attachment is missing or invalid.'); |
||
57 | } |
||
58 | $this->widget['height'] = $height; |
||
59 | |||
60 | if (! filter_var($width, FILTER_VALIDATE_INT) || $width <= 0) { |
||
61 | throw CouldNotSendNotification::flockAttachmentViewWidgetException('Width of widget in attachment is missing or invalid.'); |
||
62 | } |
||
63 | $this->widget['width'] = $width; |
||
64 | |||
65 | return $this; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param string $inline |
||
70 | * @param int|null $height |
||
71 | * @param int|null $width |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function html($inline, $height = null, $width = null) |
||
76 | { |
||
77 | $this->html['inline'] = $inline; |
||
78 | |||
79 | if (! filter_var($height, FILTER_VALIDATE_INT) || $height <= 0) { |
||
80 | throw CouldNotSendNotification::flockAttachmentViewHtmlException('Height of inline html in attachment is missing or invalid.'); |
||
81 | } |
||
82 | $this->html['height'] = $height; |
||
83 | |||
84 | if (! filter_var($width, FILTER_VALIDATE_INT) || $width <= 0) { |
||
85 | throw CouldNotSendNotification::flockAttachmentViewHtmlException('Width of inline html in attachment is missing or invalid.'); |
||
86 | } |
||
87 | $this->html['width'] = $width; |
||
88 | |||
89 | return $this; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * Create and FlockML sting. |
||
94 | * |
||
95 | * @param string $string |
||
96 | * |
||
97 | * @return $this |
||
98 | */ |
||
99 | public function flockml($string) |
||
105 | |||
106 | /** |
||
107 | * Define an image for the attachment. |
||
108 | * |
||
109 | * @param \Closure $callback |
||
110 | * @return $this |
||
111 | */ |
||
112 | public function image(Closure $callback) |
||
120 | } |
||
121 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..