From 3e815691df76bc91629235244aa2dbf9d68c0fd0 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sat, 14 May 2022 22:03:55 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Validator=EC=97=90=20stringArrray,=20in?= =?UTF-8?q?t,=20float=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sammo/Validator.php | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/sammo/Validator.php b/src/sammo/Validator.php index 5718421f..51825b44 100644 --- a/src/sammo/Validator.php +++ b/src/sammo/Validator.php @@ -54,6 +54,56 @@ class Validator extends \Valitron\Validator return true; } + /** + * Validate that a field is an string array + * + * @param string $field + * @param mixed $value + * @return bool + */ + protected function validateStringArray($field, $value) + { + if(!is_array($value)){ + return false; + } + foreach($value as $subItem){ + if(!is_string($subItem)){ + return false; + } + } + return true; + } + + /** + * Validate that a field is an integer value + * + * @param string $field + * @param mixed $value + * @return bool + */ + protected function validateInt($field, $value) + { + if(!is_int($value)){ + return false; + } + return true; + } + + /** + * Validate that a field is an float value + * + * @param string $field + * @param mixed $value + * @return bool + */ + protected function validateFloat($field, $value) + { + if(!is_float($value)){ + return false; + } + return true; + } + /** * 문자열의 '최대 너비'를 확인함. mb_strwidth 기반 *