Passed
Pull Request — master (#317)
by Guilherme
04:03
created

BlockedPhoneNumber::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\CoreBundle\Model\PersonInterface;
16
use LoginCidadao\PhoneVerificationBundle\Model\BlockedPhoneNumberInterface;
17
18
/**
19
 * Class BlockedPhoneNumber
20
 *
21
 * @package LoginCidadao\PhoneVerificationBundle\Model
22
 *
23
 * @ORM\Entity(repositoryClass="LoginCidadao\PhoneVerificationBundle\Entity\BlockedPhoneNumberRepository")
24
 * @ORM\Table(name="blocked_phone_number", indexes={
25
 *     @ORM\Index(name="blocked_phone_number_idx", columns={"phone_number"})
26
 * })
27
 * @ORM\HasLifecycleCallbacks
28
 */
29
class BlockedPhoneNumber implements BlockedPhoneNumberInterface
30
{
31
    /**
32
     * @var integer
33
     *
34
     * @ORM\Column(name="id", type="integer")
35
     * @ORM\Id
36
     * @ORM\GeneratedValue(strategy="AUTO")
37
     */
38
    private $id;
39
40
    /**
41
     * @var PhoneNumber
42
     *
43
     * @ORM\Column(name="phone_number", type="phone_number", nullable=false, unique=true)
44
     */
45
    private $phoneNumber;
46
47
    /**
48
     * @var PersonInterface
49
     *
50
     * @ORM\ManyToOne(targetEntity="LoginCidadao\CoreBundle\Entity\Person")
51
     * @ORM\JoinColumn(name="blocked_by_person_id", referencedColumnName="id", unique=false)
52
     */
53
    private $blockedBy;
54
55
    /**
56
     * @var \DateTime
57
     *
58
     * @ORM\Column(name="created_at", type="datetime", nullable=true)
59
     */
60
    private $createdAt;
61
62 2
    public function __construct(PhoneNumber $phoneNumber, PersonInterface $blockedBy, \DateTime $createdAt)
63
    {
64 2
        $this->phoneNumber = $phoneNumber;
65 2
        $this->blockedBy = $blockedBy;
66 2
        $this->createdAt = $createdAt;
67 2
    }
68
69 1
    public function getId()
70
    {
71 1
        return $this->id;
72
    }
73
74 2
    public function getPhoneNumber(): PhoneNumber
75
    {
76 2
        return $this->phoneNumber;
77
    }
78
79 2
    public function getBlockedBy(): PersonInterface
80
    {
81 2
        return $this->blockedBy;
82
    }
83
84 2
    public function getCreatedAt(): \DateTime
85
    {
86 2
        return $this->createdAt;
87
    }
88
}
89