Year::now()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace ValueObjects\DateTime;
4
5
use ValueObjects\Number\Integer;
6
7
class Year extends Integer
8
{
9
    /**
10
     * Returns the current year.
11
     *
12
     * @return Year
13
     */
14 4
    public static function now()
15
    {
16 4
        $now  = new \DateTime('now');
17 4
        $year = \intval($now->format('Y'));
18
19 4
        return new static($year);
20
    }
21
}
22