Completed
Push — master ( 6c3139...bec789 )
by Andrii
12:16
created

ReadmeMarkdownController::actionIndex()   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
 * README plugin for HiDev.
4
 *
5
 * @link      https://github.com/hiqdev/hidev-readme
6
 * @package   hidev-readme
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\readme\console;
12
13
use hidev\helpers\FileHelper;
14
use Yii;
15
16
/**
17
 * Goal for README.md file generation.
18
 * @author Andrii Vasyliev <[email protected]>
19
 */
20
class ReadmeMarkdownController extends \hidev\base\Controller
21
{
22
    public $path;
23
24
    public function actionIndex()
25
    {
26
        FileHelper::write($this->getPath(), $this->getContent());
27
    }
28
29
    public function getPath()
30
    {
31
        return $this->path ?: $this->id;
32
    }
33
34
    public function getContent()
35
    {
36
        return $this->getComponent()->render('readme-md');
37
    }
38
39
    public function getComponent()
40
    {
41
        return $this->getApp()->get('readme');
42
    }
43
}
44