| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace seregazhuk\PinterestBot\Api\Forms; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 5 |  |  | class Registration extends Form | 
            
                                                                        
                            
            
                                    
            
            
                | 6 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 7 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 8 |  |  |      * @var string | 
            
                                                                        
                            
            
                                    
            
            
                | 9 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  |     protected $email; | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |      * @var string | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |     protected $password; | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |      * @var string | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |     protected $name; | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |      * @var string | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |     protected $country = 'GB'; | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |      * @var string | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |     protected $age = '18'; | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |      * @var string | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |     protected $gender = 'male'; | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |      * @var string | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |     protected $site; | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |      * @param string $email | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |      * @param string $password | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |      * @param string $name | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |     public function __construct($email, $password, $name) | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |         $this->email = $email; | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |         $this->password = $password; | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |         $this->name = $name; | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |      * @param mixed $email | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |     public function setEmail($email) | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |         $this->email = $email; | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |      * @param string $password | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |     public function setPassword($password) | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |         $this->password = $password; | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |      * @param string $name | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     public function setName($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         $this->name = $name; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 81 |  |  |         return $this; | 
            
                                                                        
                                                                
            
                                    
            
            
                | 82 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |      * @param string $country | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |     public function setCountry($country) | 
            
                                                                        
                            
            
                                    
            
            
                | 89 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 90 |  |  |         $this->country = $country; | 
            
                                                                        
                            
            
                                    
            
            
                | 91 |  |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 95 |  |  |      * @param int $age | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 97 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 98 |  |  |     public function setAge($age) | 
            
                                                                        
                            
            
                                    
            
            
                | 99 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 100 |  |  |         // Pinterest requires age to be a string | 
            
                                                                        
                            
            
                                    
            
            
                | 101 |  |  |         $this->age = (string)$age; | 
            
                                                                        
                            
            
                                    
            
            
                | 102 |  |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 103 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 105 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 106 |  |  |      * @param string $gender | 
            
                                                                        
                            
            
                                    
            
            
                | 107 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 108 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 109 |  |  |     public function setGender($gender) | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |         $this->gender = $gender; | 
            
                                                                        
                            
            
                                    
            
            
                | 112 |  |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 115 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 116 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 117 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     public function setMaleGender() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 120 |  |  |         return $this->setGender('male'); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 121 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 123 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 124 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 125 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     public function setFemaleGender() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 128 |  |  |         return $this->setGender('female'); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 129 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 130 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 131 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 132 |  |  |      * @return array | 
            
                                                                        
                            
            
                                    
            
            
                | 133 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 134 |  |  |     public function getData() | 
            
                                                                        
                            
            
                                    
            
            
                | 135 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 136 |  |  |         return [ | 
            
                                                                        
                            
            
                                    
            
            
                | 137 |  |  |             'first_name'    => $this->name, | 
            
                                                                        
                            
            
                                    
            
            
                | 138 |  |  |             'email'         => $this->email, | 
            
                                                                        
                            
            
                                    
            
            
                | 139 |  |  |             'password'      => $this->password, | 
            
                                                                        
                            
            
                                    
            
            
                | 140 |  |  |             'age'           => $this->age, | 
            
                                                                        
                            
            
                                    
            
            
                | 141 |  |  |             'gender'        => $this->gender, | 
            
                                                                        
                            
            
                                    
            
            
                | 142 |  |  |             'country'       => $this->country, | 
            
                                                                        
                            
            
                                    
            
            
                | 143 |  |  |             'site'          => $this->site, | 
            
                                                                        
                            
            
                                    
            
            
                | 144 |  |  |             'container'     => 'home_page', | 
            
                                                                        
                            
            
                                    
            
            
                | 145 |  |  |             'visited_pages' => [], | 
            
                                                                        
                            
            
                                    
            
            
                | 146 |  |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 147 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 149 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 150 |  |  |      * @param string $site | 
            
                                                                        
                            
            
                                    
            
            
                | 151 |  |  |      * @return Registration | 
            
                                                                        
                            
            
                                    
            
            
                | 152 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |     public function setSite($site) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         $this->site = $site; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 156 |  |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 157 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 158 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 159 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 160 |  |  |      * @return string | 
            
                                                                        
                            
            
                                    
            
            
                | 161 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |     public function getSite() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 164 |  |  |         return $this->site; | 
            
                                                                        
                                                                
            
                                    
            
            
                | 165 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 166 |  |  | } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 167 |  |  |  |