Completed
Push — master ( 796a23...ede25c )
by Daniel
02:31
created

EntityDateTrait   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 1
cbo 0
dl 0
loc 39
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getCreated() 0 4 1
A setCreated() 0 4 1
A getUpdated() 0 4 1
A setUpdated() 0 4 1
1
<?php
2
3
namespace Application\Domain;
4
5
trait EntityDateTrait
6
{
7
    protected $created;
8
    protected $updated;
9
10
    public function __construct()
11
    {
12
        $this->created = new \DateTime('now');
13
    }
14
15
    /**
16
     * @return \DateTime
17
     */
18
    public function getCreated()
19
    {
20
        return $this->created;
21
    }
22
23
    /**
24
     * @param \DateTime $date
25
     */
26
    public function setCreated(\DateTime $date)
27
    {
28
        $this->created = $date;
29
    }
30
31
    /**
32
     * @return \DateTime
33
     */
34
    public function getUpdated()
35
    {
36
        return $this->updated;
37
    }
38
39
    public function setUpdated()
40
    {
41
        $this->updated = new \DateTime('now');
42
    }
43
}