Completed
Push — master ( 50cc67...a8ce2f )
by Valentyn
03:46
created

UserProfile::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Users\Entity;
6
7
use Doctrine\Common\Collections\ArrayCollection;
8
use Doctrine\ORM\Mapping as ORM;
9
use Symfony\Component\Serializer\Annotation\Groups;
10
11
/**
12
 * @ORM\Entity
13
 * @ORM\Table(name="users_profiles")
14
 */
15
class UserProfile
16
{
17
    /**
18
     * @ORM\Id()
19
     * @ORM\GeneratedValue()
20
     * @ORM\Column(type="integer")
21
     */
22
    private $id;
23
24
    /**
25
     * @var UserProfileContacts[]|ArrayCollection
26
     * @ORM\OneToMany(targetEntity="App\Users\Entity\UserProfileContacts", mappedBy="profile", cascade={"persist", "remove"})
27
     * @ORM\JoinColumn(nullable=true)
28
     * @Groups({"view"})
29
     */
30
    private $contacts;
31
32
    /**
33
     * @ORM\Column(type="string", length=255, nullable=true)
34
     * @Groups({"list", "view"})
35
     */
36
    private $first_name;
37
38
    /**
39
     * @ORM\Column(type="string", length=255, nullable=true)
40
     * @Groups({"list", "view"})
41
     */
42
    private $last_name;
43
44
    /**
45
     * @ORM\Column(type="date", nullable=true)
46
     * @Groups({"view"})
47
     */
48
    private $birth_date;
49
50
    /**
51
     * @ORM\Column(type="string", length=255, nullable=true)
52
     * @Groups({"view"})
53
     */
54
    private $about;
55
56
    /**
57
     * @ORM\Column(type="string", length=255, nullable=true)
58
     * @Groups({"view"})
59
     */
60
    private $public_email;
61
62 32
    public function __construct()
63
    {
64 32
        $this->contacts = new ArrayCollection();
65 32
    }
66
67
    /**
68
     * @return mixed
69
     */
70 5
    public function getFirstName()
71
    {
72 5
        return $this->first_name;
73
    }
74
75
    /**
76
     * @param mixed $first_name
77
     *
78
     * @return UserProfile
79
     */
80
    public function setFirstName($first_name)
81
    {
82
        $this->first_name = $first_name;
83
84
        return $this;
85
    }
86
87
    /**
88
     * @return mixed
89
     */
90 5
    public function getLastName()
91
    {
92 5
        return $this->last_name;
93
    }
94
95
    /**
96
     * @param mixed $last_name
97
     *
98
     * @return UserProfile
99
     */
100
    public function setLastName($last_name)
101
    {
102
        $this->last_name = $last_name;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @return mixed
109
     */
110 4
    public function getAbout()
111
    {
112 4
        return $this->about;
113
    }
114
115
    /**
116
     * @param mixed $about
117
     *
118
     * @return UserProfile
119
     */
120
    public function setAbout($about)
121
    {
122
        $this->about = $about;
123
124
        return $this;
125
    }
126
127
    /**
128
     * @return mixed
129
     */
130 4
    public function getPublicEmail()
131
    {
132 4
        return $this->public_email;
133
    }
134
135
    /**
136
     * @param mixed $public_email
137
     *
138
     * @return UserProfile
139
     */
140
    public function setPublicEmail($public_email)
141
    {
142
        $this->public_email = $public_email;
143
144
        return $this;
145
    }
146
147
    /**
148
     * @return mixed
149
     */
150 1
    public function getId()
151
    {
152 1
        return $this->id;
153
    }
154
155
    /**
156
     * @return mixed
157
     */
158 6
    public function getBirthDate()
159
    {
160 6
        return $this->birth_date;
161
    }
162
163
    /**
164
     * @param \DateTimeInterface $birth_date
165
     *
166
     * @return UserProfile
167
     */
168 1
    public function setBirthDate(\DateTimeInterface $birth_date)
169
    {
170 1
        $this->birth_date = $birth_date;
171
172 1
        return $this;
173
    }
174
175
    /**
176
     * @return UserProfileContacts[]|ArrayCollection
177
     */
178 6
    public function getContacts()
179
    {
180 6
        return $this->contacts->toArray();
181
    }
182
183
    /**
184
     * @param $name
185
     * @param $url
186
     *
187
     * @return $this
188
     */
189 1
    public function addContacts($name, $url)
190
    {
191 1
        $contact = new UserProfileContacts($this, $name, $url);
192 1
        $this->contacts->add($contact);
193
194 1
        return $this;
195
    }
196
}
197