Completed
Push — master ( 8384e0...9365a3 )
by Andrii
13:06
created

LicenseController::getContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * License plugin for HiDev
5
 *
6
 * @link      https://github.com/hiqdev/hidev-license
7
 * @package   hidev-license
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\license\console;
13
14
use hidev\helpers\FileHelper;
15
16
/**
17
 * License generation.
18
 */
19
class LicenseController extends \hidev\base\Controller
20
{
21
    public $path;
22
23
    public function actionIndex()
24
    {
25
        FileHelper::write($this->getPath(), $this->getContent());
26
    }
27
28
    public function getPath()
29
    {
30
        return $this->path ?: $this->id;
31
    }
32
33
    public function getContent()
34
    {
35
        return $this->getComponent()->render($this->getComponent()->getTemplate());
36
    }
37
38
    public function getComponent()
39
    {
40
        return $this->getApp()->get('license');
41
    }
42
}
43