From a4642d17e0e1ea018b128efdcc3db281461458b1 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Wed, 4 Apr 2018 15:21:13 -0700 Subject: Move custom libs to the source tree --- libs/SimpleValidator/Validators/Base.php | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 libs/SimpleValidator/Validators/Base.php (limited to 'libs/SimpleValidator/Validators/Base.php') diff --git a/libs/SimpleValidator/Validators/Base.php b/libs/SimpleValidator/Validators/Base.php new file mode 100644 index 00000000..8157ae50 --- /dev/null +++ b/libs/SimpleValidator/Validators/Base.php @@ -0,0 +1,37 @@ +field = $field; + $this->error_message = $error_message; + } + + public function getErrorMessage() + { + return $this->error_message; + } + + public function getField() + { + if (is_array($this->field)) { + return $this->field[0]; + } + + return $this->field; + } + + public function isFieldNotEmpty(array $data) + { + return isset($data[$this->field]) && $data[$this->field] !== ''; + } +} -- cgit v1.2.3