TimestampableEntity   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 44
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getCreatedAt() 0 3 1
A getUpdatedAt() 0 3 1
A setUpdatedAt() 0 5 1
A setCreatedAt() 0 5 1
1
<?php declare(strict_types = 1);
2
3
namespace Simplex\Quickstart\Shared\Doctrine;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
use JMS\Serializer\Annotation as Serializer;
8
9
trait TimestampableEntity
10
{
11
    /**
12
     * @var \DateTime
13
     *
14
     * @Gedmo\Timestampable(on="create")
15
     * @ORM\Column(type="datetime")
16
     *
17
     * @Serializer\Exclude()
18
     */
19
    protected $createdAt;
20
21
    /**
22
     * @var \DateTime
23
     *
24
     * @Gedmo\Timestampable(on="update")
25
     * @ORM\Column(type="datetime")
26
     *
27
     * @Serializer\Exclude()
28
     */
29
    protected $updatedAt;
30
31
    public function setCreatedAt(\DateTime $createdAt): self
32
    {
33
        $this->createdAt = $createdAt;
34
35
        return $this;
36
    }
37
38
    public function getCreatedAt(): \DateTime
39
    {
40
        return $this->createdAt;
41
    }
42
43
    public function setUpdatedAt(\DateTime $updatedAt): self
44
    {
45
        $this->updatedAt = $updatedAt;
46
47
        return $this;
48
    }
49
50
    public function getUpdatedAt(): \DateTime
51
    {
52
        return $this->updatedAt;
53
    }
54
}
55