helpers.php ➔ widget()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 3
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
if (! function_exists('widget')) {
6
    /**
7
     * Instantiate a widget instance.
8
     *
9
     * @param string $widget
10
     * @param array  $params
11
     * @param bool   $async
12
     *
13
     * @throws \Rinvex\Widgets\Exceptions\WidgetException
14
     *
15
     * @return \Illuminate\Support\HtmlString
16
     */
17
    function widget($widget, array $params = [], bool $async = false)
18
    {
19
        $factory = app('rinvex.widgets');
20
21
        if (func_num_args() === 0) {
22
            return $factory;
23
        }
24
25
        return $factory->make($widget, $params, $async);
26
    }
27
}
28