Test Failed
Pull Request — master (#228)
by Guilherme
03:49
created

SentVerification::setFinished()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 0
cp 0
crap 2
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\PhoneVerificationBundle\Entity;
12
13
use Doctrine\ORM\Mapping as ORM;
14
use libphonenumber\PhoneNumber;
15
use LoginCidadao\PhoneVerificationBundle\Model\SentVerificationInterface;
16
17
/**
18
 * Class SentVerification
19
 *
20
 * @ORM\Table(
21
 *     name="sent_verification",
22
 *     indexes={@ORM\Index(name="idx_phone", columns={"phone"})}
23
 * )
24
 * @ORM\Entity(repositoryClass="LoginCidadao\PhoneVerificationBundle\Entity\SentVerificationRepository")
25
 */
26
class SentVerification implements SentVerificationInterface
27
{
28
    /**
29
     * @var integer
30
     *
31
     * @ORM\Column(name="id", type="integer")
32
     * @ORM\Id
33
     * @ORM\GeneratedValue(strategy="AUTO")
34
     */
35
    private $id;
36
37
    /**
38
     * @var PhoneNumber
39
     *
40
     * @ORM\Column(type="phone_number", nullable=false)
41
     */
42
    private $phone;
43
44
    /**
45
     * @var \DateTime
46
     *
47
     * @ORM\Column(name="sent_at", type="datetime", nullable=false)
48
     */
49
    private $sentAt;
50
51
    /**
52
     * @var string
53
     *
54
     * @ORM\Column(name="message_sent", type="string", length=255, nullable=true)
55
     */
56
    private $messageSent;
57
58
    /**
59
     * @var string
60
     *
61
     * @ORM\Column(name="transaction_id", type="string", length=255, nullable=false)
62
     */
63
    private $transactionId;
64
65
    /**
66
     * @var bool
67
     *
68 1
     * @ORM\Column(name="finished", type="boolean", nullable=true)
69
     */
70 1
    private $finished;
71
72
    /**
73
     * @var \DateTime
74
     *
75
     * @ORM\Column(name="actually_sent_at", type="datetime", nullable=true)
76 1
     */
77
    private $actuallySentAt;
78 1
79
    /**
80
     * @var \DateTime
81
     *
82
     * @ORM\Column(name="delivered_at", type="datetime", nullable=true)
83
     */
84
    private $deliveredAt;
85 1
86
    /**
87 1
     * @return mixed
88
     */
89 1
    public function getId()
90
    {
91
        return $this->id;
92
    }
93
94
    /**
95 1
     * @return PhoneNumber
96
     */
97 1
    public function getPhone()
98
    {
99
        return $this->phone;
100
    }
101
102
    /**
103
     * @param PhoneNumber $phone
104 1
     * @return SentVerificationInterface
105
     */
106 1
    public function setPhone(PhoneNumber $phone)
107
    {
108 1
        $this->phone = $phone;
109
110
        return $this;
111
    }
112
113
    /**
114 1
     * @return \DateTime
115
     */
116 1
    public function getSentAt()
117
    {
118
        return $this->sentAt;
119
    }
120
121
    /**
122
     * @param \DateTime $sentAt
123 1
     * @return SentVerificationInterface
124
     */
125 1
    public function setSentAt(\DateTime $sentAt)
126
    {
127 1
        $this->sentAt = $sentAt;
128
129
        return $this;
130
    }
131
132
    /**
133 1
     * @return string
134
     */
135 1
    public function getMessageSent()
136
    {
137
        return $this->messageSent;
138
    }
139
140
    /**
141
     * @param string $message
142 1
     * @return SentVerificationInterface
143
     */
144 1
    public function setMessageSent($message)
145
    {
146 1
        $this->messageSent = $message;
147
148
        return $this;
149
    }
150
151
    /**
152
     * @return string
153
     */
154
    public function getTransactionId()
155
    {
156
        return $this->transactionId;
157
    }
158
159
    /**
160
     * @param string $transactionId
161
     * @return SentVerification
162
     */
163
    public function setTransactionId($transactionId)
164
    {
165
        $this->transactionId = $transactionId;
166
167
        return $this;
168
    }
169
170
    /**
171
     * Get the date the message was actually sent to the user's phone
172
     *
173
     * @return \DateTime
174
     */
175
    public function getActuallySentAt()
176
    {
177
        return $this->actuallySentAt;
178
    }
179
180
    /**
181
     * Set the date the message was actually sent to the user's phone
182
     *
183
     * @param \DateTime $sentAt
184
     * @return SentVerificationInterface
185
     */
186
    public function setActuallySentAt(\DateTime $sentAt = null)
187
    {
188
        $this->actuallySentAt = $sentAt;
189
190
        return $this;
191
    }
192
193
    /**
194
     * @return \DateTime
195
     */
196
    public function getDeliveredAt()
197
    {
198
        return $this->deliveredAt;
199
    }
200
201
    /**
202
     * @param \DateTime $deliveredAt
203
     * @return SentVerificationInterface
204
     */
205
    public function setDeliveredAt(\DateTime $deliveredAt = null)
206
    {
207
        $this->deliveredAt = $deliveredAt;
208
209
        return $this;
210
    }
211
212
    /**
213
     * Determines whether or not a SentVerification status reached it's final state.
214
     * @return bool
215
     */
216
    public function isFinished()
217
    {
218
        return $this->finished === true ? true : false;
219
    }
220
221
    /**
222
     * @param bool $finished
223
     * @return SentVerificationInterface
224
     */
225
    public function setFinished($finished = true)
226
    {
227
        $this->finished = $finished;
228
229
        return $this;
230
    }
231
}
232