Conditions | 5 |
Paths | 9 |
Total Lines | 20 |
Lines | 6 |
Ratio | 30 % |
Changes | 0 |
1 | <?php |
||
39 | public function getAll(): array |
||
40 | { |
||
41 | $widgets = []; |
||
42 | View Code Duplication | if (\App\Cache::has('Widgets', $this->moduleName)) { |
|
43 | $widgetsData = \App\Cache::get('Widgets', $this->moduleName); |
||
44 | } else { |
||
45 | $widgetsData = \App\Api::getInstance()->call("{$this->moduleName}/Widgets") ?: []; |
||
46 | \App\Cache::save('Widgets', $this->moduleName, $widgetsData, \App\Cache::LONG); |
||
47 | } |
||
48 | foreach ($widgetsData as $widgetData) { |
||
49 | if (!\in_array($widgetData['type'], ['RelatedModule'])) { |
||
50 | continue; |
||
51 | } |
||
52 | $handlerModule = \App\Loader::getModuleClassName($this->moduleName, 'Widget', $widgetData['type']); |
||
53 | $widget = new $handlerModule($this->moduleName); |
||
54 | $widget->setData($widgetData); |
||
55 | $widgets[$widgetData['id']] = $widget; |
||
56 | } |
||
57 | return $widgets; |
||
58 | } |
||
59 | } |
||
60 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.