TimeTrait::getTime()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace BrainExe\Core\Traits;
4
5
use BrainExe\Core\Annotations\Inject;
6
use BrainExe\Core\Util\Time;
7
8
/**
9
 * @api
10
 */
11
trait TimeTrait
12
{
13
14
    /**
15
     * @var Time
16
     */
17
    private $time;
18
19
    /**
20
     * @Inject
21
     * @param Time $time
22
     */
23 9
    public function setTime(Time $time)
24
    {
25 9
        $this->time = $time;
26 9
    }
27
28
    /**
29
     * @return Time
30
     */
31 1
    public function getTime() : Time
32
    {
33 1
        return $this->time;
34
    }
35
36
    /**
37
     * @return int
38
     */
39 4
    public function now() : int
40
    {
41 4
        return $this->time->now();
42
    }
43
}
44