email() public static method

Assert that value is an email adress (using input_filter/FILTER_VALIDATE_EMAIL).
public static email ( mixed $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value mixed
$message string | null
$propertyPath string | null
return boolean
Exemplo n.º 1
0
 /**
  * @param string $value
  */
 private function __construct($value)
 {
     if (!empty($value)) {
         Guard::email($value, 'Email Address is invalid');
     }
     $this->value = $value;
 }
Exemplo n.º 2
0
 /**
  * @param $email
  */
 protected function setEmail($email)
 {
     $email = trim($email);
     if (!$email) {
         throw new \InvalidArgumentException('email');
     }
     Assertion::email($email);
     $this->email = strtolower($email);
 }
Exemplo n.º 3
0
 /**
  * @param $name
  * @param $email
  * @param $password
  * @return User
  */
 public function register($name, $email, $password)
 {
     Assertion::string($name);
     Assertion::email($email);
     $password = bcrypt($password);
     $user = User::register($name, $email, $password);
     $this->users->add($user);
     return $user;
 }
Exemplo n.º 4
0
 /**
  * @param $email
  */
 private function setEmail($email)
 {
     $email = trim($email);
     if (!$email) {
         throw new \InvalidArgumentException('Email cannot be empty');
     }
     Assertion::email($email);
     $this->email = strtolower($email);
 }
Exemplo n.º 5
0
 public function __construct($value)
 {
     try {
         Assertion::email($value);
         $this->value = $value;
     } catch (AssertionInvalidArgumentException $exception) {
         throw new InvalidArgumentException($value, array('email'));
     }
 }
Exemplo n.º 6
0
 /**
  * @param int $gender
  * @param string $firstName
  * @param string $lastName
  * @param string $email
  */
 public function __construct($gender, $firstName, $lastName, $email)
 {
     Assertion::choice($gender, [self::GENDER_MALE, self::GENDER_FEMALE]);
     Assertion::notEmpty($firstName);
     Assertion::notEmpty($lastName);
     Assertion::email($email);
     $this->gender = $gender;
     $this->firstName = $firstName;
     $this->lastName = $lastName;
     $this->email = $email;
 }
Exemplo n.º 7
0
 /**
  * Create a new Email
  *
  * @param string $value
  * @return void
  */
 public function __construct($value)
 {
     Assertion::email($value);
     $this->value = $value;
 }
Exemplo n.º 8
0
 public function testValidEmail()
 {
     Assertion::email("*****@*****.**");
 }
Exemplo n.º 9
0
 public function __construct($email)
 {
     Assertion::email($email, "Invalid email address {$email}");
     $this->email = $email;
 }
Exemplo n.º 10
0
 /**
  * @param string $email
  */
 public function __construct($email)
 {
     Assertion::email($email);
     $this->email = $email;
 }
Exemplo n.º 11
0
 /**
  * Sets the customer email
  *
  * @param string $customerEmail
  */
 public function setCustomerEmail($customerEmail)
 {
     Assertion::email($customerEmail);
     $this->customerEmail = $customerEmail;
 }
Exemplo n.º 12
0
 /**
  * @param string $email
  */
 public function setEmail($email)
 {
     if (null === $email) {
         throw new \InvalidArgumentException('email');
     }
     Assertion::email($email);
     $this->email = $email;
 }
Exemplo n.º 13
0
 /**
  * @param mixed $email
  */
 public function setEmail($email)
 {
     Assertion::email($email);
     $this->email = $email;
 }
Exemplo n.º 14
0
 /**
  * The address is validated before setting it
  *
  * @param $address
  */
 protected function setAddress($address)
 {
     Assertion::email($address, "{$address} is not a valid email address");
     $this->address = $address;
 }