CopyrightYears   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0
ccs 0
cts 8
cp 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 9 3
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