sanitize($value); if (is_numeric($value)) { if ($value > $this->getSize()) { $fail(sprintf(__('%s must be greater than or equal to %s', 'give'), '{field}', $this->getSize())); } } elseif (is_string($value)) { if (mb_strlen($value) > $this->getSize()) { $fail(sprintf(__('%s must be more than or equal to %d characters', 'give'), '{field}', $this->getSize())); } } else { Config::throwValidationException("Field value must be a number or string"); } } }