User   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 19
dl 0
loc 91
ccs 9
cts 10
cp 0.9
rs 10
c 2
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setSex() 0 7 3
A getSex() 0 3 1
A setBirthday() 0 3 1
A getBirthday() 0 3 1
1
<?php
2
/**
3
 * SocialConnect project
4
 * @author: Patsura Dmitry @ovr <[email protected]>
5
 */
6
7
namespace SocialConnect\Common\Entity;
8
9
class User extends \stdClass
10
{
11
    const SEX_MALE = 'male';
12
    const SEX_FEMALE = 'female';
13
14
    /**
15
     * @var string
16
     */
17
    public $id;
18
19
    /**
20
     * @var string
21
     */
22
    public $firstname;
23
24
    /**
25
     * @var string
26
     */
27
    public $lastname;
28
29
    /**
30
     * @var string
31
     */
32
    public $email;
33
34
    /**
35
     * @var bool
36
     */
37
    public $emailVerified = false;
38
39
    /**
40
     * @var \DateTime|null
41
     */
42
    protected $birthday;
43
44
    /**
45
     * @var string|null
46
     */
47
    public $username;
48
49
    /**
50
     * Should be female or male
51
     *
52
     * @var string|null
53
     */
54
    protected $sex;
55
56
    /**
57
     * @var string|null
58
     */
59
    public $fullname;
60
61
    /**
62
     * @var string|null
63
     */
64
    public $pictureURL;
65
66
    /**
67
     * @return \DateTime|null
68
     */
69 1
    public function getBirthday(): ?\DateTime
70
    {
71 1
        return $this->birthday;
72
    }
73
74
    /**
75
     * @param \DateTime|null $birthday
76
     */
77 2
    public function setBirthday(?\DateTime $birthday): void
78
    {
79 2
        $this->birthday = $birthday;
80
    }
81
82
    /**
83
     * @return string|null
84
     */
85 2
    public function getSex(): ?string
86
    {
87 2
        return $this->sex;
88
    }
89
90
    /**
91
     * @param string $sex
92
     */
93 3
    public function setSex(string $sex): void
94
    {
95 3
        if ($sex !== self::SEX_MALE && $sex !== self::SEX_FEMALE) {
96
            throw new \InvalidArgumentException('Argument $sex is not valid');
97
        }
98
99 3
        $this->sex = $sex;
100
    }
101
}
102