AbstractMenu::widget()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * Pluggable themes for Yii2
4
 *
5
 * @link      https://github.com/hiqdev/yii2-thememanager
6
 * @package   yii2-thememanager
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\thememanager\menus;
12
13
use Yii;
14
15
/**
16
 * Abstract Menu.
17
 *
18
 * @author Andrii Vasyliev <[email protected]>
19
 */
20
abstract class AbstractMenu implements MenuInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public static function widget($menuConfig = [], $widgetConfig = [])
26
    {
27
        return static::create($menuConfig)->run($widgetConfig);
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public static function create($config = [])
34
    {
35
        $config['class'] = get_called_class();
36
37
        return Yii::createObject($config);
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    abstract public function run($config = []);
44
}
45