Completed
Push — master ( 5ec4be...3f1e8c )
by Paweł
08:46
created

TimestampableTrait::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 1
cp 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher Common Component.
5
 *
6
 * Copyright 2016 Sourcefabric z.u. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2016 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Component\Common\Model;
16
17
trait TimestampableTrait
18
{
19
    /**
20
     * @var \DateTime
21
     */
22
    protected $createdAt;
23
24
    /**
25
     * @var \DateTime
26
     */
27
    protected $updatedAt;
28
29
    public function __construct()
30
    {
31
        $this->createdAt = new \DateTime();
32
    }
33
34
    /**
35
     * @return \DateTime
36
     */
37
    public function getCreatedAt()
38
    {
39
        return $this->createdAt;
40
    }
41
42
    /**
43
     * @return \DateTime
44
     */
45
    public function getUpdatedAt()
46
    {
47
        return $this->updatedAt;
48 102
    }
49
50 102
    /**
51 102
     * @param \DateTime $createdAt
52
     */
53
    public function setCreatedAt(\DateTime $createdAt)
54
    {
55
        $this->createdAt = $createdAt;
56 2
    }
57
58 2
    /**
59 2
     * @param \DateTime $updatedAt
60
     */
61
    public function setUpdatedAt(\DateTime $updatedAt)
62
    {
63
        $this->updatedAt = $updatedAt;
64
    }
65
}
66