CopyrightYears::run()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
ccs 0
cts 8
cp 0
cc 3
nc 3
nop 0
crap 12
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\widgets;
12
13
/**
14
 * CopyrightYears widget - renders copyright years like "2016-2017".
15
 * @author Andrii Vasyliev <[email protected]>
16
 */
17
class CopyrightYears extends \yii\base\Widget
18
{
19
    /**
20
     * @var string copyright years
21
     */
22
    public $years;
23
24
    /**
25
     * @var string copyright year
26
     */
27
    public $year;
28
29
    public function run()
30
    {
31
        if ($this->years) {
32
            return $this->years;
33
        }
34
        $curr = date('Y');
35
36
        return $this->year ? "{$this->year}-$curr" : $curr;
37
    }
38
}
39