Min.php 844 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * PHP表单生成器
  4. *
  5. * @package FormBuilder
  6. * @author xaboy <xaboy2005@qq.com>
  7. * @version 2.0
  8. * @license MIT
  9. * @link https://github.com/xaboy/form-builder
  10. * @document http://php.form-create.com
  11. */
  12. namespace FormBuilder\Annotation\Validate;
  13. /**
  14. * @Annotation
  15. */
  16. final class Min extends ValidateAnnotation
  17. {
  18. /**
  19. * @Required
  20. */
  21. public $value;
  22. public function parseRule($rule)
  23. {
  24. $rule = $this->tidyValidate($rule);
  25. $rule['validate'][] = ['min' => $this->value, 'type' => $this->type, 'trigger' => $this->trigger, 'message' => $this->message];
  26. return $rule;
  27. }
  28. public function parseComponent($component)
  29. {
  30. $component->appendValidate($component->createValidate()->min($this->value)->message($this->message));
  31. return $component;
  32. }
  33. }