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

EntityDateTrait::setCreated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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
}