PhpCs::getTemplate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * PHP-CS-Fixer plugin for HiDev
4
 *
5
 * @link      https://github.com/hiqdev/hidev-php-cs-fixer
6
 * @package   hidev-php-cs-fixer
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\phpcsfixer\components;
12
13
/**
14
 * `.php_cs` (php-cs-fixer config) file generation.
15
 */
16
class PhpCs extends \hidev\components\File
17
{
18
    protected $_file = '.php_cs';
19
20
    public function getTemplate()
21
    {
22
        $version = $this->getFixer()->getVersion();
23
        $vno = substr($version, 0, 1);
24
25
        return "php-cs-v$vno.twig";
26
    }
27
28
    public function getFixer()
29
    {
30
        return $this->take('php-cs-fixer');
31
    }
32
33
    public function getCasedLevel()
34
    {
35
        $level = strtolower($this->level);
36
37
        return $level === 'symfony' ? 'Symfony' : strtoupper($level);
38
    }
39
}
40