alexpts/simple-validator

View on GitHub
src/PTS/Validator/Validators/MinValidator.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
declare(strict_types=1);

namespace PTS\Validator\Validators;

class MinValidator
{
    public function __invoke($value, $min): bool
    {
        if (is_int($value) || is_float($value)) {
            return $value >= $min;
        }

        if (is_array($value)) {
            return count($value) >= $min;
        }

        return mb_strlen($value) >= $min;
    }
}