ValidateAnnotation.php 773 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. use FormBuilder\Contract\AnnotationInterface;
  14. abstract class ValidateAnnotation implements AnnotationInterface
  15. {
  16. /**
  17. * @var string
  18. */
  19. public $message;
  20. /**
  21. * @var string
  22. */
  23. public $type = 'string';
  24. /**
  25. * @var string
  26. */
  27. public $trigger = 'change';
  28. public function tidyValidate($rule)
  29. {
  30. if (!isset($rule['validate']) || !is_array($rule['validate'])) {
  31. $rule['validate'] = [];
  32. }
  33. return $rule;
  34. }
  35. }