1
0
Fork 0
mirror of synced 2024-07-01 04:30:59 +12:00
appwrite/src/Appwrite/Network/Validator/Email.php

57 lines
915 B
PHP
Raw Normal View History

2021-03-24 06:27:51 +13:00
<?php
2021-03-25 06:47:17 +13:00
namespace Appwrite\Network\Validator;
2021-03-24 06:27:51 +13:00
use Utopia\Validator;
/**
* Email
*
* Validate that an variable is a valid email address
*
* @package Utopia\Validator
*/
class Email extends Validator
{
/**
* Get Description
*
* Returns validator description
*
* @return string
*/
public function getDescription()
{
return 'Value must be a valid email address';
}
/**
* Get Type
*
* Returns validator type.
*
* @return string
*/
public function getType()
{
2021-03-25 07:35:36 +13:00
return 'string';
2021-03-24 06:27:51 +13:00
}
/**
* Is valid
*
* Validation will pass when $value is valid email address.
*
* @param mixed $value
* @return bool
*/
public function isValid($value)
{
if (!\filter_var($value, FILTER_VALIDATE_EMAIL)) {
return false;
}
return true;
}
}