AssetConverter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 6 1
A runCommand() 0 9 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;
12
13
use Yii;
14
15
/**
16
 * Asset Converter.
17
 */
18
class AssetConverter extends \yii\web\AssetConverter
19
{
20
    public function init()
21
    {
22
        $this->commands = array_merge([
23
            'php' => ['css', 'render'],
24
        ], $this->commands);
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function runCommand($command, $basePath, $asset, $result)
31
    {
32
        if ($command === 'render') {
33
            $res = Yii::$app->getView()->renderFile("$basePath/$asset");
34
            file_put_contents("$basePath/$result", $res);
35
        } else {
36
            return parent::runCommand($command, $basePath, $asset, $result);
37
        }
38
    }
39
}
40