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
 /**
  * @param string $value
  */
 private function __construct($value)
 {
     if (!empty($value)) {
         Guard::email($value, 'Email Address is invalid');
     }
     $this->value = $value;
 }
示例#2
0
 /**
  * @param $email
  */
 protected function setEmail($email)
 {
     $email = trim($email);
     if (!$email) {
         throw new \InvalidArgumentException('email');
     }
     Assertion::email($email);
     $this->email = strtolower($email);
 }
示例#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;
 }
示例#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);
 }
示例#5
0
 public function __construct($value)
 {
     try {
         Assertion::email($value);
         $this->value = $value;
     } catch (AssertionInvalidArgumentException $exception) {
         throw new InvalidArgumentException($value, array('email'));
     }
 }
示例#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;
 }
示例#7
0
文件: Email.php 项目: alle/cribbb
 /**
  * Create a new Email
  *
  * @param string $value
  * @return void
  */
 public function __construct($value)
 {
     Assertion::email($value);
     $this->value = $value;
 }
示例#8
0
 public function testValidEmail()
 {
     Assertion::email("*****@*****.**");
 }
示例#9
0
 public function __construct($email)
 {
     Assertion::email($email, "Invalid email address {$email}");
     $this->email = $email;
 }
示例#10
0
 /**
  * @param string $email
  */
 public function __construct($email)
 {
     Assertion::email($email);
     $this->email = $email;
 }
示例#11
0
 /**
  * Sets the customer email
  *
  * @param string $customerEmail
  */
 public function setCustomerEmail($customerEmail)
 {
     Assertion::email($customerEmail);
     $this->customerEmail = $customerEmail;
 }
示例#12
0
 /**
  * @param string $email
  */
 public function setEmail($email)
 {
     if (null === $email) {
         throw new \InvalidArgumentException('email');
     }
     Assertion::email($email);
     $this->email = $email;
 }
示例#13
0
文件: Email.php 项目: ymnl007/Usher
 /**
  * @param mixed $email
  */
 public function setEmail($email)
 {
     Assertion::email($email);
     $this->email = $email;
 }
示例#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;
 }