diff options
Diffstat (limited to 'libs/SimpleValidator/Validators/NotEmpty.php')
-rw-r--r-- | libs/SimpleValidator/Validators/NotEmpty.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/SimpleValidator/Validators/NotEmpty.php b/libs/SimpleValidator/Validators/NotEmpty.php new file mode 100644 index 00000000..bbb14b5b --- /dev/null +++ b/libs/SimpleValidator/Validators/NotEmpty.php @@ -0,0 +1,15 @@ +<?php + +namespace SimpleValidator\Validators; + +class NotEmpty extends Base +{ + public function execute(array $data) + { + if (array_key_exists($this->field, $data)) { + return $data[$this->field] !== null && $data[$this->field] !== ''; + } + + return true; + } +} |