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

LicenseController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A actionIndex() 0 4 1
A getPath() 0 4 2
A getContent() 0 4 1
A getComponent() 0 4 1
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