123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace crmeb\form\validate;
- use crmeb\form\CommonRule;
- abstract class BaseRules
- {
-
- protected static $init = false;
-
- protected static $rule;
-
- public static function getType(): string
- {
- return '';
- }
-
- public static function init()
- {
- if (!self::$init) {
- self::$rule = new CommonRule();
- self::$rule->type(static::getType());
- self::$init = true;
- }
- }
-
- public static function __callStatic($name, $arguments)
- {
- self::init();
- if (method_exists(self::$rule, $name)) {
- return self::$rule->{$name}(...$arguments);
- }
- throw new FormValidate(__CLASS__ . ' Method does not exist' . $name . '()');
- }
- }
|