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

TimeTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 71.43%

Importance

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

3 Methods

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