Module   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 17
ccs 0
cts 11
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 6 1
A getViewPath() 0 5 1
1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\base;
12
13
use ReflectionClass;
14
use Yii;
15
use yii\base\ViewContextInterface;
16
17
/**
18
 * A file to be processed with hidev.
19
 *
20
 * @property string $minimalPath path to minimal example file
21
 */
22
class Module extends \yii\base\Module implements ViewContextInterface
23
{
24
    use GettersTrait;
25
26
    public function render($view, $params = [])
27
    {
28
        return Yii::$app->getView()->render($view, array_merge([
29
            'module' => $this,
30
            'config' => Yii::$app->get('config'),
31
        ], $params), $this);
32
    }
33
34
    public function getViewPath()
35
    {
36
        $ref = new ReflectionClass($this);
37
38
        return dirname($ref->getFileName()) . '/views';
39
    }
40
}
41