1 | <?php |
||
11 | class WidgetFactory |
||
12 | { |
||
13 | /** |
||
14 | * Widget object to work with. |
||
15 | * |
||
16 | * @var \Rinvex\Widgets\Models\AbstractWidget |
||
17 | */ |
||
18 | protected $widget; |
||
19 | |||
20 | /** |
||
21 | * Instantiate a widget instance. |
||
22 | * |
||
23 | * @param string $widget |
||
24 | * @param array $params |
||
25 | * @param bool $async |
||
26 | * |
||
27 | * @throws \Rinvex\Widgets\Exceptions\WidgetException |
||
28 | * |
||
29 | * @return \Illuminate\Support\HtmlString |
||
30 | */ |
||
31 | public function make(string $widget, array $params = [], bool $async = false) |
||
48 | |||
49 | /** |
||
50 | * Wrap the given content in a container if it's not an async call. |
||
51 | * |
||
52 | * @param string $content |
||
53 | * |
||
54 | * @return string |
||
55 | */ |
||
56 | protected function wrapContentInContainer(string $content): string |
||
62 | |||
63 | /** |
||
64 | * Encrypt widget params to be transported via HTTP. |
||
65 | * |
||
66 | * @param array $params |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | public function encryptWidgetParams(array $params = []): string |
||
74 | |||
75 | /** |
||
76 | * Decrypt widget params that were transported via HTTP. |
||
77 | * |
||
78 | * @param string $params |
||
79 | * |
||
80 | * @return array |
||
81 | */ |
||
82 | public function decryptWidgetParams(string $params = ''): array |
||
86 | |||
87 | /** |
||
88 | * Construct javascript code to load the widget. |
||
89 | * |
||
90 | * @param float $timeout |
||
|
|||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | protected function getLoader(float $timeout = 0): string |
||
102 | |||
103 | /** |
||
104 | * Construct async call for loaders. |
||
105 | * |
||
106 | * @throws \Throwable |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | protected function constructAsyncCall(): string |
||
119 | |||
120 | /** |
||
121 | * Prepare widget content. |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | protected function prepareContent(): string |
||
136 | |||
137 | /** |
||
138 | * Prepare async widget content. |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | protected function prepareAsyncContent(): string |
||
147 | } |
||
148 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.