检查类是否匹配，支持通配符*
@param string $rule
@param string $className
@return boolean
964168
public static function checkClassRule($rule, $className)
    {
        list($classRule, ) = explode('::', $rule, 2);
        return static::checkRuleMatch($classRule, $className);
    }
235815
public function configureRule(Rule $rule)
    {
        if ($config = $this->getRuleConfig($rule)) {
            
            if (isset($config['type'])) {
                $rule->setType($config['type']);
            }
            
            if (isset($config['format'])) {
                $rule->setFormat($config['format']);
            }
            
            if (isset($config['attribute'])) {
                $rule->setAttribute($config['attribute']);
            }
            
        }
        
        return $rule;
    }
598547
public function addRule(Rule $rule)
    {
        $classname = $rule->getClass();
        if ($this->hasRule($classname) === true) {
            throw new Exception(
                "failed to add rule; the field {$this->name} already has an ".
                "instance of '$classname'"
            );
        }
        else if ($classname === Rule::REQUIRED) {
            $this->rules = [$classname => $rule] + $this->rules;
        }
        else {
            $this->rules[$classname] = $rule;
        }
        return $this;
    }
488942
private static function isRule($rule) {

		if(false === is_string($rule)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($rule)), E_USER_ERROR);
		}

		$class = static :: getRuleClass($rule);

		return true === class_exists($class);
	}
219405
public function rule($name, $rule='')
    {
        if (is_array($name)) {
            $this->rule=array_merge($this->rule, $name);
        } else {
            $this->rule[$name]=$rule;
        }
        return $this;
    }
938535
public function hasClass($className)
    {
        if(strlen($className) < 1)
        {
            throw new HTMLTagException("Class name is empty");
        }

        if($this->hasAttribute("class"))
        {
            $classes = $this->getClasses();

            foreach(explode(" ",$classes) as $class) {
                if(strtolower($class) == strtolower($className)) {
                    return true;    // We found it.
                }
            }

        }

        return false;
    }
1177301
public static function getAttributesFor($className)
    {
        if (!self::attributesSetFor($className)) {
            # Force initialize.
            $className::getAttributeSet();
        }
        return self::$classAttributes[$className];
    }
654786
public function evaluate(Rule $rule)
    {
        if (is_array($rule->getLeft()) && is_array($rule->getRight())) {
            $intersect = array_intersect($rule->getLeft(), $rule->getRight());
            if (array_diff($rule->getRight(), $intersect))
                return false;
            return true;
        } elseif (is_array($rule->getLeft()) && !is_array($rule->getRight())) {
            return in_array($rule->getRight(), $rule->getLeft());
        } elseif (!is_array($rule->getLeft()) && is_array($rule->getRight())) {
            return in_array($rule->getLeft(), $rule->getRight());
        }

        return false;
    }
1180786
public function check($rule = []) {
		$rule = $rule ?: $this->validate;

		/* 检查文件大小 */
		if (isset($rule['size']) && !$this->checkSize($rule['size'])) {
			$this->error = '上传文件大小不符！';
			return false;
		}

		/* 检查文件Mime类型 */
		if (isset($rule['type']) && !$this->checkMime($rule['type'])) {
			$this->error = '上传文件MIME类型不允许！';
			return false;
		}

		/* 检查文件后缀 */
		if (isset($rule['ext']) && !$this->checkExt($rule['ext'])) {
			$this->error = '上传文件后缀不允许';
			return false;
		}

		/* 检查图像文件 */
		if (!$this->checkImg()) {
			$this->error = '非法图像文件！';
			return false;
		}

		return true;
	}
572636
public function isValidDriverClass($className)
    {
        if (!class_exists($className)) {
            return false;
        }

        if (!is_subclass_of($className, 'Bex\\Behat\\ExtensionDriverLocator\\DriverInterface')) {
            return false;
        }

        if (!empty($this->parent) && !is_subclass_of($className, $this->parent)) {
            return false;
        }

        return true;
    }
1227060
function &getRule($ruleName)
    {
        list($class, $path) = $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName];

        if (!isset($this->_rules[$class])) {
            if (!empty($path)) {
                include_once($path);
            }
            $this->_rules[$class] = new $class();
        }
        $this->_rules[$class]->setName($ruleName);
        return $this->_rules[$class];
    }
1088039
private static function checkAllow($rule)
	{
		foreach($rule as $item)
		{
			$mca = explode('/',$item);
			if(!isset($mca[2]))
			{
				throw new Exception('allow 规则' . $item . '格式错误！');
			}
			if($mca[0] !== self::$module && $mca[0] !== '*')
			{
				continue;
			}
			if($mca[1] !== self::$control && $mca[1] !== '*')
			{
				continue;
			}
			if($mca[2] === self::$action || $mca[2] === '*')
			{
				return true;
			}
		}
		return false;
	}
1073748
public static function parseRule($validatorType, $rule)
    {
        $className = \get_class($validatorType);

        if (empty(self::$rules[$className])) {
            self::buildRules($validatorType, $className);
        }

        $ruleName   = \explode(":", $rule);
        $methodName = self::getMethodName($className, $ruleName[0]);

        $arguments = \substr($rule, \strlen($ruleName[0]) + 1, \strlen($rule));
        $arguments = \explode(":", $arguments);
        $arguments = self::convertStringBooleanToBoolean($arguments);

        return [$methodName, $arguments];
    }
1178649
public function removeRule($field, $rule)
    {
        if (isset($this->rules[$field][$rule])) {
            unset($this->rules[$field][$rule]);
            return true;
        }
        return false;
    }
1111914
public function doParser(string $className)
    {
        if(!isset($this->data[$className]))
        {
            return;
        }
        // 类
        if(isset($this->data[$className]['class']))
        {
            foreach($this->data[$className]['class'] as $annotation)
            {
                $annotationClassName = get_class($annotation);
                if($this->hasParser($annotationClassName))
                {
                    $this->getParser($annotationClassName)->parse($annotation, $className, BaseParser::TARGET_CLASS, $className);
                }
                else
                {
                    $this->one('parseComplete.' . $annotationClassName, function() use($annotationClassName, $annotation, $className){
                        $annotationClassName = get_class($annotation);
                        if($this->hasParser($annotationClassName))
                        {
                            $this->getParser($annotationClassName)->parse($annotation, $className, BaseParser::TARGET_CLASS, $className);
                        }
                    });
                }
            }
            AnnotationManager::addClassAnnotations($className, ...$this->data[$className]['class']);
        }
        // 属性
        if(isset($this->data[$className]['prop']))
        {
            foreach($this->data[$className]['prop'] as $propName => $annotations)
            {
                foreach($annotations as $annotation)
                {
                    $annotationClassName = get_class($annotation);
                    if($this->hasParser($annotationClassName))
                    {
                        $this->getParser($annotationClassName)->parse($annotation, $className, BaseParser::TARGET_PROPERTY, $propName);
                    }
                    else
                    {
                        $this->one('parseComplete.' . $annotationClassName, function() use($annotationClassName, $annotation, $className, $propName){
                            $annotationClassName = get_class($annotation);
                            if($this->hasParser($annotationClassName))
                            {
                                $this->getParser($annotationClassName)->parse($annotation, $className, BaseParser::TARGET_PROPERTY, $propName);
                            }
                        });
                    }
                }
                AnnotationManager::addPropertyAnnotations($className, $propName, ...$annotations);
            }
        }
        // 方法
        if(isset($this->data[$className]['method']))
        {
            foreach($this->data[$className]['method'] as $methodName => $annotations)
            {
                foreach($annotations as $annotation)
                {
                    $annotationClassName = get_class($annotation);
                    if($this->hasParser($annotationClassName))
                    {
                        $this->getParser($annotationClassName)->parse($annotation, $className, BaseParser::TARGET_METHOD, $methodName);
                    }
                    else
                    {
                        $this->one('parseComplete.' . $annotationClassName, function() use($annotationClassName, $annotation, $className, $methodName){
                            $annotationClassName = get_class($annotation);
                            if($this->hasParser($annotationClassName))
                            {
                                $this->getParser($annotationClassName)->parse($annotation, $className, BaseParser::TARGET_METHOD, $methodName);
                            }
                        });
                    }
                }
                AnnotationManager::addMethodAnnotations($className, $methodName, ...$annotations);
            }
        }
        // 常量
        if(isset($this->data[$className]['const']))
        {
            foreach($this->data[$className]['const'] as $constName => $annotations)
            {
                foreach($annotations as $annotation)
                {
                    $annotationClassName = get_class($annotation);
                    if($this->hasParser($annotationClassName))
                    {
                        $this->getParser($annotationClassName)->parse($annotation, $className, BaseParser::TARGET_CONST, $constName);
                    }
                    else
                    {
                        $this->one('parseComplete.' . $annotationClassName, function() use($annotationClassName, $annotation, $className, $constName){
                            $annotationClassName = get_class($annotation);
                            if($this->hasParser($annotationClassName))
                            {
                                $this->getParser($annotationClassName)->parse($annotation, $className, BaseParser::TARGET_CONST, $constName);
                            }
                        });
                    }
                }
                AnnotationManager::addConstantAnnotations($className, $constName, ...$annotations);
            }
        }
    }
674468
public static function isClassAbstract($className)
    {
        if (!class_exists($className)) {
            return false;
        }

        $reflectionClass = new \ReflectionClass($className);

        return $reflectionClass->isAbstract();
    }
1371570
public function addClass($className)
  {
    if (!is_numeric(array_search($className, $this->classes))) {
      $this->classes[] = $className;
      return true;
    }
    return false;
  }