Code Duplication    Length = 16-16 lines in 2 locations

src/Utils/WidgetJsonifier.php 1 location

@@ 14-29 (lines=16) @@
11
     * @param array $args
12
     * @return string
13
     */
14
    public function jsonResponse($widget, ...$args)
15
    {
16
        if (is_string($widget)) {
17
            $widget = $this->makeWidgetObj($widget);
18
        }
19
20
        app(Normalizer::class)->normalizeJsonWidget($widget);
21
22
        try {
23
            $json = $this->generateJson($widget, ...$args);
24
        } catch (\Exception $e) {
25
            return app()->make(ExceptionHandler::class)->render(app('request'), $e)->send();
26
        }
27
28
        return $json;
29
    }
30
31
    /**
32
     * @param $widget object

src/Utils/WidgetRenderer.php 1 location

@@ 28-43 (lines=16) @@
25
     * @param array $args
26
     * @return string
27
     */
28
    public function renderWidget($widget, ...$args)
29
    {
30
        if (is_string($widget)) {
31
            $widget = $this->makeWidgetObj($widget);
32
        }
33
34
        app(Normalizer::class)->normalizeWidgetConfig($widget);
35
36
        try {
37
            $html = $this->generateHtml($widget, ...$args);
38
        } catch (\Exception $e) {
39
            return app()->make(ExceptionHandler::class)->render(app('request'), $e)->send();
40
        }
41
42
        return $html;
43
    }
44
45
    /**
46
     * @param $widget object