Completed
Push — master ( 27b0a5...2d0d9b )
by Sergey
05:06 queued 02:29
created

Registration::setEmail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
nc 1
cc 1
eloc 3
nop 1
1
<?php
2
3
namespace seregazhuk\PinterestBot\Api\Forms;
4
5
class Registration extends Form
6
{
7
    protected $email;
8
    protected $password;
9
    protected $name;
10
    protected $country = 'GB';
11
    protected $age = 18;
12
    protected $gender = 'male';
13
    protected $site;
14
15
    /**
16
     * @param string $email
17
     * @param string $password
18
     * @param string $name
19
     */
20
    public function __construct($email, $password, $name)
21
    {
22
        $this->email = $email;
23
        $this->password = $password;
24
        $this->name = $name;
25
    }
26
27
    /**
28
     * @param mixed $email
29
     * @return Registration
30
     */
31
    public function setEmail($email)
32
    {
33
        $this->email = $email;
34
        return $this;
35
    }
36
37
    /**
38
     * @param mixed $password
39
     * @return Registration
40
     */
41
    public function setPassword($password)
42
    {
43
        $this->password = $password;
44
        return $this;
45
    }
46
47
    /**
48
     * @param mixed $name
49
     * @return Registration
50
     */
51
    public function setName($name)
52
    {
53
        $this->name = $name;
54
        return $this;
55
    }
56
57
    /**
58
     * @param mixed $country
59
     * @return Registration
60
     */
61
    public function setCountry($country)
62
    {
63
        $this->country = $country;
64
        return $this;
65
    }
66
67
    /**
68
     * @param mixed $age
69
     * @return Registration
70
     */
71
    public function setAge($age)
72
    {
73
        $this->age = $age;
74
        return $this;
75
    }
76
77
    /**
78
     * @param mixed $gender
79
     * @return Registration
80
     */
81
    public function setGender($gender)
82
    {
83
        $this->gender = $gender;
84
        return $this;
85
    }
86
87
    /**
88
     * @return Registration
89
     */
90
    public function setMaleGender()
91
    {
92
        return $this->setGender('male');
93
    }
94
95
    /**
96
     * @return Registration
97
     */
98
    public function setFemaleGender()
99
    {
100
        return $this->setGender('female');
101
    }
102
103
    /**
104
     * @return array
105
     */
106
    public function toArray()
107
    {
108
        return [
109
            'name'      => $this->name,
110
            'email'     => $this->email,
111
            'password'  => $this->password,
112
            'age'       => $this->age,
113
            'gender'    => $this->gender,
114
            'country'   => $this->country,
115
            'site'      => $this->site,
116
            'container' => 'home_page',
117
        ];
118
    }
119
120
    /**
121
     * @param mixed $site
122
     * @return Registration
123
     */
124
    public function setSite($site)
125
    {
126
        $this->site = $site;
127
        return $this;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getSite()
134
    {
135
        return $this->site;
136
    }
137
}