Skip to content

Commit

Permalink
Added validator email.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Pospisil committed Mar 13, 2017
1 parent 03f0d66 commit cd2a511
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/IParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cd2a511

Please sign in to comment.