Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

fix register #512

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 72 additions & 44 deletions src/Api/Forms/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,115 +52,143 @@ public function __construct($email, $password, $name)
}

/**
* @param mixed $email
* @param string $country
* @return Registration
*/
public function setEmail($email)
public function setCountry($country)
{
$this->email = $email;
$this->country = $country;
return $this;
}

/**
* @param string $password
* @param int $age
* @return Registration
*/
public function setPassword($password)
public function setAge($age)
{
$this->password = $password;
// Pinterest requires age to be a string
$this->age = (string)$age;
return $this;
}

/**
* @param string $name
* @return Registration
*/
public function setName($name)
public function setMaleGender()
{
$this->name = $name;
return $this;
return $this->setGender('male');
}

/**
* @param string $country
* @param string $gender
* @return Registration
*/
public function setCountry($country)
public function setGender($gender)
{
$this->country = $country;
$this->gender = $gender;
return $this;
}

/**
* @param int $age
* @return Registration
*/
public function setAge($age)
public function setFemaleGender()
{
// Pinterest requires age to be a string
$this->age = (string)$age;
return $this;
return $this->setGender('female');
}

/**
* @param string $gender
* @return array
*/
public function getData()
{
return [
'first_name' => $this->name,
'email' => $this->email,
'password' => $this->password,
'age' => $this->age,
'gender' => $this->gender,
'country' => $this->country,
'site' => $this->site,
'container' => 'home_page',
'signupSource' => 'home_page',
'hybridTier' => 'open',
'page' => 'home',
'recaptchaV3Token' => '',
'user_behavior_data' => "{}",
];
}

/**
* @return string
*/
public function getSite()
{
return $this->site;
}

/**
* @param string $site
* @return Registration
*/
public function setGender($gender)
public function setSite($site)
{
$this->gender = $gender;
$this->site = $site;
return $this;
}

/**
* @return Registration
* @return string
*/
public function setMaleGender()
public function getName(): string
{
return $this->setGender('male');
return $this->name;
}

/**
* @param string $name
* @return Registration
*/
public function setFemaleGender()
public function setName($name)
{
return $this->setGender('female');
$this->name = $name;
return $this;
}

/**
* @return array
* @return string
*/
public function getData()
public function getEmail(): string
{
return [
'first_name' => $this->name,
'email' => $this->email,
'password' => $this->password,
'age' => $this->age,
'gender' => $this->gender,
'country' => $this->country,
'site' => $this->site,
'container' => 'home_page',
'visited_pages' => [],
];
return $this->email;
}

/**
* @param string $site
* @param mixed $email
* @return Registration
*/
public function setSite($site)
public function setEmail($email)
{
$this->site = $site;
$this->email = $email;
return $this;
}

/**
* @return string
*/
public function getSite()
public function getPassword(): string
{
return $this->site;
return $this->password;
}

/**
* @param string $password
* @return Registration
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
}
Loading