LedgerEntry.php 6.02 KB
Newer Older
1
2
3
<?php

namespace T3o\Karma\Domain\Model;
mabolek's avatar
mabolek committed
4

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/***************************************************************
 *  Copyright notice
 *
 *  (c) 2018
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
 *
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
mabolek's avatar
mabolek committed
27
28
class LedgerEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
29
30
31
32
33
34
35
36
37
38
    /**
     * @var \DateTime
     */
    protected $crdate;

    /**
     * @var \DateTime
     */
    protected $tstamp;

mabolek's avatar
mabolek committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
    /**
     * The date when the entry expired, if set.
     *
     * Set when the entry expires.
     *
     * @var int
     */
    protected $expired;

    /**
     * The unchangeable ledgerentry entry value
     *
     * @var int
     */
    protected $immutableValue;

    /**
     * The changeable ledgerentry entry value.
     *
     * Can be depreciated over time or set to zero.
     *
     * @var int
     */
    protected $mutableValue;

    /**
65
     * The entry karma source code
mabolek's avatar
mabolek committed
66
     *
67
     * @var string
mabolek's avatar
mabolek committed
68
69
70
     */
    protected $karmaSource;

71
72
73
74
75
76
77
78
79
80
    /**
     * @var string
     */
    protected $issuer;

    /**
     * @var string
     */
    protected $issuerAction;

mabolek's avatar
mabolek committed
81
82
83
    /**
     * Set to the related campaign if the entry is generated through a campaign
     *
84
     * @var \T3o\Karma\Domain\Model\Campaign
mabolek's avatar
mabolek committed
85
86
87
88
89
90
     */
    protected $campaign;

    /**
     * The user the entry is valid for
     *
91
     * @var \T3o\Karma\Domain\Model\FrontendUser
mabolek's avatar
mabolek committed
92
93
94
     */
    protected $user;

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
    /**
     * Get the creation date
     *
     * @return \DateTime
     */
    public function getCrdate(): \DateTime
    {
        return $this->crdate;
    }

    /**
     * Set the creation date
     *
     * @param \DateTime $crdate
     */
    public function setCrdate(\DateTime $crdate)
    {
        $this->crdate = $crdate;
    }

    /**
     * Get the last modified timestamp
     *
     * @return \DateTime
     */
    public function getTstamp(): \DateTime
    {
        return $this->tstamp;
    }

    /**
     * Set the last modified timestamp
     *
     * @param \DateTime $tstamp
     */
    public function setTstamp(\DateTime $tstamp)
    {
        $this->tstamp = $tstamp;
    }

mabolek's avatar
mabolek committed
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
    /**
     * Return the expired timestamp or zero if not yet expired
     *
     * @return int
     */
    public function getExpired()
    {
        return $this->expired;
    }

    /**
     * Returns true if the entry has expired
     *
     * @return bool
     */
    public function isExpired()
    {
        return (bool)$this->getExpired();
    }

    /**
     * Set the timestamp for the entry's expiry, or zero if the entry has not expired
     *
     * @param int $expired
     */
    public function setExpired(int $expired)
    {
        $this->expired = $expired;
    }

    /**
     * Returns the unchangeable entry value
     *
     * @return int
     */
    public function getImmutableValue()
    {
        return $this->immutableValue;
    }

    /**
     * Set the unchangeable entry value.
     *
     * Should only be done once.
     *
     * @param int $immutableValue
     */
    public function setImmutableValue(int $immutableValue)
    {
        $this->immutableValue = $immutableValue;
    }

    /**
     * Returns the changeable entry value
     *
     * @return int
     */
    public function getMutableValue()
    {
        return $this->mutableValue;
    }

    /**
     * Set the changeable entry value
     *
     * @param int $mutableValue
     */
    public function setMutableValue(int $mutableValue)
    {
        $this->mutableValue = $mutableValue;
    }

    /**
     * Get the entry karma source
     *
210
     * @return string
mabolek's avatar
mabolek committed
211
212
213
214
215
216
217
218
219
     */
    public function getKarmaSource()
    {
        return $this->karmaSource;
    }

    /**
     * Set the entry karma source
     *
220
     * @param string $karmaSource
mabolek's avatar
mabolek committed
221
     */
222
    public function setKarmaSource(string $karmaSource)
mabolek's avatar
mabolek committed
223
224
225
226
    {
        $this->karmaSource = $karmaSource;
    }

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
    /**
     * Get the issuer code
     *
     * @return string
     */
    public function getIssuer()
    {
        return $this->issuer;
    }

    /**
     * Set the issuer code
     *
     * @param string $issuer
     */
    public function setIssuer(string $issuer)
    {
        $this->issuer = $issuer;
    }

    /**
     * Get the issuer action code
     *
     * @return string
     */
    public function getIssuerAction()
    {
        return $this->issuerAction;
    }

    /**
     * Set the issuer action code
     *
     * @param string $issuerAction
     */
    public function setIssuerAction(string $issuerAction)
    {
        $this->issuerAction = $issuerAction;
    }

mabolek's avatar
mabolek committed
267
268
269
    /**
     * Get the entry campaign that generated this entry, or null if no campaign
     *
270
     * @return \T3o\Karma\Domain\Model\Campaign
mabolek's avatar
mabolek committed
271
272
273
274
275
276
277
278
279
     */
    public function getCampaign()
    {
        return $this->campaign;
    }

    /**
     * Set the campaign that generated this entry
     *
280
     * @param \T3o\Karma\Domain\Model\Campaign $campaign
mabolek's avatar
mabolek committed
281
282
283
284
285
286
287
288
289
     */
    public function setCampaign(Campaign $campaign)
    {
        $this->campaign = $campaign;
    }

    /**
     * Get the user this entry is for
     *
290
     * @return \T3o\Karma\Domain\Model\FrontendUser
mabolek's avatar
mabolek committed
291
292
293
294
295
296
297
298
299
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Set the user the entry is for
     *
300
     * @param \T3o\Karma\Domain\Model\FrontendUser $user
mabolek's avatar
mabolek committed
301
302
303
304
305
     */
    public function setUser(FrontendUser $user)
    {
        $this->user = $user;
    }
306
}