diff --git a/src/Validator/StringLengthBetween.php b/src/Validator/StringLengthBetween.php index d0df507..3b89b0d 100644 --- a/src/Validator/StringLengthBetween.php +++ b/src/Validator/StringLengthBetween.php @@ -15,11 +15,10 @@ protected function describe() */ protected function parse($value) { - if (!is_string($value)) { - return null; + if (strlen($value) >= $this->minValue && strlen($value) <= $this->maxValue) { + return $value; } - $value = strlen($value); - return parent::parse($value); + return null; } /** diff --git a/src/Validator/StringLengthLargerThanOrEqualToParser.php b/src/Validator/StringLengthLargerThanOrEqualToParser.php index 112e5ec..e170eab 100644 --- a/src/Validator/StringLengthLargerThanOrEqualToParser.php +++ b/src/Validator/StringLengthLargerThanOrEqualToParser.php @@ -15,11 +15,10 @@ protected function describe() */ protected function parse($value) { - if (!is_string($value)) { - return null; + if (strlen($value) >= $this->minValue) { + return $value; } - $value = strlen($value); - return parent::parse($value); + return null; } /** diff --git a/src/Validator/StringLengthLargerThanParser.php b/src/Validator/StringLengthLargerThanParser.php index eb4b1a7..04c46ef 100644 --- a/src/Validator/StringLengthLargerThanParser.php +++ b/src/Validator/StringLengthLargerThanParser.php @@ -15,11 +15,10 @@ protected function describe() */ protected function parse($value) { - if (!is_string($value)) { - return null; + if (strlen($value) > $this->minValue) { + return $value; } - $value = strlen($value); - return parent::parse($value); + return null; } /** diff --git a/src/Validator/StringLengthSmallerThanOrEqualToParser.php b/src/Validator/StringLengthSmallerThanOrEqualToParser.php index 32143cb..f187878 100644 --- a/src/Validator/StringLengthSmallerThanOrEqualToParser.php +++ b/src/Validator/StringLengthSmallerThanOrEqualToParser.php @@ -15,11 +15,10 @@ protected function describe() */ protected function parse($value) { - if (!is_string($value)) { - return null; + if (strlen($value) <= $this->maxValue) { + return $value; } - $value = strlen($value); - return parent::parse($value); + return null; } /** diff --git a/src/Validator/StringLengthSmallerThanParser.php b/src/Validator/StringLengthSmallerThanParser.php index d2d0691..3f948ff 100644 --- a/src/Validator/StringLengthSmallerThanParser.php +++ b/src/Validator/StringLengthSmallerThanParser.php @@ -15,11 +15,10 @@ protected function describe() */ protected function parse($value) { - if (!is_string($value)) { - return null; + if (strlen($value) < $this->maxValue) { + return $value; } - $value = strlen($value); - return parent::parse($value); + return null; } /**