ThreadInterface::setCreatedBy()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 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\Model;
12
13
use Miliooo\Messaging\User\ParticipantInterface;
14
use Doctrine\Common\Collections\ArrayCollection;
15
16
/**
17
 * The interface class used by the thread model
18
 *
19
 * @author Michiel Boeckaert <[email protected]>
20
 */
21
interface ThreadInterface extends BuilderInterface
22
{
23
    /**
24
     * Gets the unique id of the thread.
25
     *
26
     * @return integer The unique id
27
     */
28
    public function getId();
29
30
    /**
31
     * Sets the subject of the thread.
32
     *
33
     * @param string $subject The subject of the thread
34
     */
35
    public function setSubject($subject);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
36
37
    /**
38
     * Gets the subject of the thread.
39
     *
40
     * @return string The subject of the thread
41
     */
42
    public function getSubject();
43
44
    /**
45
     * Sets the participant who created the thread.
46
     *
47
     * @param ParticipantInterface $participant The participant who created the thread
48
     */
49
    public function setCreatedBy(ParticipantInterface $participant);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
50
51
    /**
52
     * Gets the participant who created the thread.
53
     *
54
     * @return ParticipantInterface The participant who created the thread
55
     */
56
    public function getCreatedBy();
57
58
    /**
59
     * Sets the datetime when the thread was created
60
     *
61
     * @param \DateTime $createdAt The creation datetime of the thread
62
     */
63
    public function setCreatedAt(\DateTime $createdAt);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
64
65
    /**
66
     * Gets the datetime when the thread was created.
67
     */
68
    public function getCreatedAt();
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
69
70
    /**
71
     * Adds a message to the thread
72
     *
73
     * @param MessageInterface $message
74
     */
75
    public function addMessage(MessageInterface $message);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
76
77
    /**
78
     * Gets all the messages contained in the thread.
79
     *
80
     * @return ArrayCollection
81
     */
82
    public function getMessages();
83
84
    /**
85
     * Gets the first message of the thread.
86
     *
87
     * @return MessageInterface The first message of the thread
88
     */
89
    public function getFirstMessage();
90
91
    /**
92
     * Gets the last message of the thread.
93
     *
94
     * @return MessageInterface The last message of the thread
95
     */
96
    public function getLastMessage();
97
98
    /**
99
     * Sets the last message.
100
     *
101
     * We set the last message of a thread because we use it in the folders overview.
102
     * If we don't do this we will loop over the whole array collection.
103
     *
104
     * There is always the trade off between denormalizing or not, if you don't want this to be denormalized
105
     * you can use $this->messages->last();
106
     *
107
     * @param MessageInterface $message
108
     */
109
    public function setLastMessage(MessageInterface $message);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
110
111
    /**
112
     * Adds thread meta to the thread meta collection
113
     *
114
     * @param ThreadMetaInterface $threadMeta
115
     */
116
    public function addThreadMeta(ThreadMetaInterface $threadMeta);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
117
118
    /**
119
     * Returns an array collection with thread meta
120
     *
121
     * @return ArrayCollection An ArrayCollection of threadmeta
122
     */
123
    public function getThreadMeta();
124
125
    /**
126
     * Gets thread meta for the given participant
127
     *
128
     * @param ParticipantInterface $participant The participant
129
     *
130
     * @return ThreadMetaInterface
131
     */
132
    public function getThreadMetaForParticipant(ParticipantInterface $participant);
133
134
    /**
135
     * Gets all the participants for the current thread
136
     *
137
     * This loops over the threadmetas and collects all the participants.
138
     * There is no method to add an participant because we don't map this in the database
139
     *
140
     * If we want to add a participant we need to create the threadmeta
141
     * and add the participant there.
142
     *
143
     * @return ParticipantInterface[] An array with participants
144
     */
145
    public function getParticipants();
146
147
    /**
148
     * Checks if the given participant is a participant of the thread
149
     *
150
     * @param ParticipantInterface $participant The participant we check
151
     *
152
     * @return boolean true if participant, false otherwise
153
     */
154
    public function isParticipant(ParticipantInterface $participant);
155
156
    /**
157
     * Gets th participants besides the given participant
158
     *
159
     * @param ParticipantInterface $participant The participant to exclude
160
     *
161
     * @return ParticipantInterface[] Array of participants
162
     */
163
    public function getOtherParticipants(ParticipantInterface $participant);
164
}
165