TimeTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setTime() 0 4 1
A getTime() 0 4 1
A now() 0 4 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