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/Integer.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 libs/SimpleValidator/Validators/Integer.php (limited to 'libs/SimpleValidator/Validators/Integer.php') diff --git a/libs/SimpleValidator/Validators/Integer.php b/libs/SimpleValidator/Validators/Integer.php new file mode 100644 index 00000000..5afdc1e0 --- /dev/null +++ b/libs/SimpleValidator/Validators/Integer.php @@ -0,0 +1,25 @@ +isFieldNotEmpty($data)) { + if (is_string($data[$this->field])) { + + if ($data[$this->field][0] === '-') { + return ctype_digit(substr($data[$this->field], 1)); + } + + return ctype_digit($data[$this->field]); + } + else { + return is_int($data[$this->field]); + } + } + + return true; + } +} -- cgit v1.2.3