UserProfile::getFirstName()   A
last analyzed

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
    /**
63
     * @ORM\Column(type="string", length=3, nullable=true)
64
     * @Groups({"list", "view"})
65
     */
66
    private $country_code;
67
68 32
    public function __construct()
69
    {
70 32
        $this->contacts = new ArrayCollection();
71 32
    }
72
73
    /**
74
     * @return mixed
75
     */
76 11
    public function getFirstName()
77
    {
78 11
        return $this->first_name;
79
    }
80
81
    /**
82
     * @param mixed $first_name
83
     *
84
     * @return UserProfile
85
     */
86 2
    public function setFirstName($first_name)
87
    {
88 2
        $this->first_name = $first_name;
89
90 2
        return $this;
91
    }
92
93
    /**
94
     * @return mixed
95
     */
96 11
    public function getLastName()
97
    {
98 11
        return $this->last_name;
99
    }
100
101
    /**
102
     * @param mixed $last_name
103
     *
104
     * @return UserProfile
105
     */
106 2
    public function setLastName($last_name)
107
    {
108 2
        $this->last_name = $last_name;
109
110 2
        return $this;
111
    }
112
113
    /**
114
     * @return mixed
115
     */
116 8
    public function getAbout()
117
    {
118 8
        return $this->about;
119
    }
120
121
    /**
122
     * @param mixed $about
123
     *
124
     * @return UserProfile
125
     */
126 2
    public function setAbout($about)
127
    {
128 2
        $this->about = $about;
129
130 2
        return $this;
131
    }
132
133
    /**
134
     * @return mixed
135
     */
136 8
    public function getPublicEmail()
137
    {
138 8
        return $this->public_email;
139
    }
140
141
    /**
142
     * @param mixed $public_email
143
     *
144
     * @return UserProfile
145
     */
146 2
    public function setPublicEmail($public_email)
147
    {
148 2
        $this->public_email = $public_email;
149
150 2
        return $this;
151
    }
152
153
    /**
154
     * @return mixed
155
     */
156 1
    public function getId()
157
    {
158 1
        return $this->id;
159
    }
160
161
    /**
162
     * @return mixed
163
     */
164 10
    public function getBirthDate()
165
    {
166 10
        return $this->birth_date;
167
    }
168
169
    /**
170
     * @param \DateTimeInterface $birth_date
171
     *
172
     * @return UserProfile
173
     */
174 3
    public function setBirthDate(\DateTimeInterface $birth_date)
175
    {
176 3
        $this->birth_date = $birth_date;
177
178 3
        return $this;
179
    }
180
181
    /**
182
     * @return UserProfileContacts[]|ArrayCollection
183
     */
184 10
    public function getContacts()
185
    {
186 10
        return $this->contacts->toArray();
187
    }
188
189
    /**
190
     * @param $name
191
     * @param $url
192
     *
193
     * @return $this
194
     */
195 1
    public function addContacts($name, $url)
196
    {
197 1
        $contact = new UserProfileContacts($this, $name, $url);
198 1
        $this->contacts->add($contact);
199
200 1
        return $this;
201
    }
202
203 2
    public function setCountryCode(string $code)
204
    {
205 2
        $this->country_code = $code ?: null;
206 2
    }
207
208 11
    public function getCountryCode(): ?string
209
    {
210 11
        return $this->country_code;
211
    }
212
}
213