/** * @param string $email * * @throws \InvalidArgumentException If email is not a string * @throws \UnexpectedValueException If email is invalid * * @return $this */ private function setEmail($email) { TypeChecker::assertString($email, '$email'); /* * @TODO Change email filter * Not suitable for production. For production, use SMTP check for filter email address. */ if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { throw new UnexpectedValueException(); } $this->email = $email; return $this; }
/** * @param string $password * * @return $this */ public function setPassword($password) { TypeChecker::assertString($password, '$password'); $this->password = $password; return $this; }