AbstractNewMessage::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the MilioooMessageBundle package.
5
 *
6
 * (c) Michiel boeckaert <[email protected]>
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Miliooo\Messaging\Form\FormModel;
12
13
use Miliooo\Messaging\User\ParticipantInterface;
14
15
/**
16
 * The abstract new message class.
17
 *
18
 * This abstract class should be used by all the form models.
19
 * Since it contains all the getters and setters for creating a message object.
20
 * Both replying of a message or creating a thread also adds a message.
21
 *
22
 * @author Michiel Boeckaert <[email protected]>
23
 */
24
abstract class AbstractNewMessage implements NewMessageInterface
25
{
26
     /**
27
     * Body of the message
28
     * @var string
29
     */
30
    protected $body;
31
32
    /**
33
     * Creation time of the message
34
     * @var \DateTime
35
     */
36
    protected $createdAt;
37
38
    /**
39
     * Sender of the message
40
     * @var ParticipantInterface
41
     */
42
    protected $sender;
43
44
    /**
45
     * Constructor.
46
     *
47
     */
48
    public function __construct()
49
    {
50
        //we will update this value in the form handler so we get the real value
51
        $this->createdAt = new \DateTime('now');
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    public function getBody()
58
    {
59
        return $this->body;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function getCreatedAt()
66
    {
67
        return $this->createdAt;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function getSender()
74
    {
75
        return $this->sender;
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function setBody($body)
82
    {
83
        $this->body = $body;
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     */
89
    public function setCreatedAt(\DateTime $createdAt)
90
    {
91
        $this->createdAt = $createdAt;
92
    }
93
94
    /**
95
     * {@inheritdoc}
96
     */
97
    public function setSender(\Miliooo\Messaging\User\ParticipantInterface $sender)
98
    {
99
        $this->sender = $sender;
100
    }
101
}
102