本文整理汇总了PHP中Assert\Assertion::email方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::email方法的具体用法?PHP Assertion::email怎么用?PHP Assertion::email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::email方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $value
*/
private function __construct($value)
{
if (!empty($value)) {
Guard::email($value, 'Email Address is invalid');
}
$this->value = $value;
}
示例2: setEmail
/**
* @param $email
*/
protected function setEmail($email)
{
$email = trim($email);
if (!$email) {
throw new \InvalidArgumentException('email');
}
Assertion::email($email);
$this->email = strtolower($email);
}
示例3: register
/**
* @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: setEmail
/**
* @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: __construct
public function __construct($value)
{
try {
Assertion::email($value);
$this->value = $value;
} catch (AssertionInvalidArgumentException $exception) {
throw new InvalidArgumentException($value, array('email'));
}
}
示例6: __construct
/**
* @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: __construct
/**
* Create a new Email
*
* @param string $value
* @return void
*/
public function __construct($value)
{
Assertion::email($value);
$this->value = $value;
}
示例8: testValidEmail
public function testValidEmail()
{
Assertion::email("123hello+world@email.provider.com");
}
示例9: __construct
public function __construct($email)
{
Assertion::email($email, "Invalid email address {$email}");
$this->email = $email;
}
示例10: __construct
/**
* @param string $email
*/
public function __construct($email)
{
Assertion::email($email);
$this->email = $email;
}
示例11: setCustomerEmail
/**
* Sets the customer email
*
* @param string $customerEmail
*/
public function setCustomerEmail($customerEmail)
{
Assertion::email($customerEmail);
$this->customerEmail = $customerEmail;
}
示例12: setEmail
/**
* @param string $email
*/
public function setEmail($email)
{
if (null === $email) {
throw new \InvalidArgumentException('email');
}
Assertion::email($email);
$this->email = $email;
}
示例13: setEmail
/**
* @param mixed $email
*/
public function setEmail($email)
{
Assertion::email($email);
$this->email = $email;
}
示例14: setAddress
/**
* 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;
}