Code Duplication    Length = 16-16 lines in 2 locations

src/Utils/WidgetJsonifier.php 1 location

@@ 15-30 (lines=16) @@
12
     * @param array $args
13
     * @return string
14
     */
15
    public function jsonResponse($widget, ...$args)
16
    {
17
        if (is_string($widget)) {
18
            $widget = $this->_makeWidgetObj($widget);
19
        }
20
21
        app(Normalizer::class)->normalizeJsonWidget($widget);
22
23
        try {
24
            $json = $this->_generateJson($widget, ...$args);
25
        } catch (\Exception $e) {
26
            return app()->make(ExceptionHandler::class)->render(app('request'), $e)->send();
27
        }
28
29
        return $json;
30
    }
31
32
    /**
33
     * It tries to get the html from cache if possible, otherwise generates it.

src/Utils/WidgetRenderer.php 1 location

@@ 26-41 (lines=16) @@
23
     * @param array $args
24
     * @return string
25
     */
26
    public function renderWidget($widget, ...$args)
27
    {
28
        if (is_string($widget)) {
29
            $widget = $this->_makeWidgetObj($widget);
30
        }
31
32
        app(Normalizer::class)->normalizeWidgetConfig($widget);
33
34
        try {
35
            $html = $this->_generateHtml($widget, ...$args);
36
        } catch (\Exception $e) {
37
            return app()->make(ExceptionHandler::class)->render(app('request'), $e)->send();
38
        }
39
40
        return $html;
41
    }
42
43
    /**
44
     * It tries to get the html from cache if possible, otherwise generates it.