From cd2a511b98d1eaaa073ac8bd695e0b9ec2b93672 Mon Sep 17 00:00:00 2001 From: Jan Pospisil Date: Mon, 13 Mar 2017 21:56:35 +0100 Subject: [PATCH] Added validator email. --- src/IParameters.php | 1 - src/Validator.php | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/IParameters.php b/src/IParameters.php index 8b978c1..f8b5908 100644 --- a/src/IParameters.php +++ b/src/IParameters.php @@ -15,7 +15,6 @@ interface IParameters { public function post($key = NULL, $isRequired = FALSE, array $validators = null); - public function get($key = NULL, $isRequired = FALSE, array $validators = null); public function path($key, $isRequired = FALSE, array $validators = null); diff --git a/src/Validator.php b/src/Validator.php index 1ce11ab..9c6eda1 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -46,6 +46,10 @@ public function validate($name, $isRequired, array $validators, $value){ if(!is_bool($value) && $value != 1 && $value != 0) throw new InvalidParameterException('Parameter "'.$name.'" must be boolean.'); $value = (bool) $value; + } elseif($validator == Check::EMAIL){ + if(!Validators::isEmail($value)){ + throw new InvalidParameterException('Parameter "'.$name.'" must be email.'); + } } else {