Completed
Pull Request — master (#10)
by Matze
07:31
created

TimeTrait::getTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace BrainExe\Core\Traits;
4
5
use BrainExe\Annotations\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("@Time")
21
     * @param Time $time
22
     */
23 16
    public function setTime(Time $time)
24
    {
25 16
        $this->time = $time;
26 16
    }
27
28
    /**
29
     * @return Time
30
     */
31
    public function getTime()
32
    {
33
        return $this->time;
34
    }
35
36
    /**
37
     * @return int
38
     */
39 4
    public function now()
40
    {
41 4
        return $this->time->now();
42
    }
43
}
44