public static function rule($rule, $value, $format = 'any', array $options = []) {
		if (!isset(static::$_rules[$rule])) {
			throw new InvalidArgumentException("Rule `{$rule}` is not a validation rule.");
		}
		$defaults = isset(static::$_options[$rule]) ? static::$_options[$rule] : [];
		$options = (array) $options + $defaults + static::$_options['defaults'];

		$ruleCheck = static::$_rules[$rule];
		$ruleCheck = is_array($ruleCheck) ? $ruleCheck : [$ruleCheck];

		if (!$options['contains'] && !empty($ruleCheck)) {
			foreach ($ruleCheck as $key => $item) {
				$ruleCheck[$key] = is_string($item) ? "/^{$item}$/" : $item;
			}
		}

		$params = compact('value', 'format', 'options');
		return Filters::run(get_called_class(), $rule, $params, static::_checkFormats($ruleCheck));
	}
public static function rule($rule, $value, $format = 'any', array $options = []) {
		if (!isset(static::$_rules[$rule])) {
			throw new InvalidArgumentException("Rule `{$rule}` is not a validation rule.");
		}
		$defaults = isset(static::$_options[$rule]) ? static::$_options[$rule] : [];
		$options = (array) $options + $defaults + static::$_options['defaults'];

		$ruleCheck = static::$_rules[$rule];
		$ruleCheck = is_array($ruleCheck) ? $ruleCheck : [$ruleCheck];

		if (!$options['contains'] && !empty($ruleCheck)) {
			foreach ($ruleCheck as $key => $item) {
				$ruleCheck[$key] = is_string($item) ? "/^{$item}$/" : $item;
			}
		}

		$params = compact('value', 'format', 'options');
		return Filters::run(get_called_class(), $rule, $params, static::_checkFormats($ruleCheck));
	}
public static function rule ( $ rule , $ value , $ format = 'any' , array $ options = [ ] ) { if ( ! isset ( static :: $ _rules [ $ rule ] ) ) { throw new InvalidArgumentException ( "Rule `{$rule}` is not a validation rule." ) ; } $ defaults = isset ( static :: $ _options [ $ rule ] ) ? static :: $ _options [ $ rule ] : [ ] ; $ options = ( array ) $ options + $ defaults + static :: $ _options [ 'defaults' ] ; $ ruleCheck = static :: $ _rules [ $ rule ] ; $ ruleCheck = is_array ( $ ruleCheck ) ? $ ruleCheck : [ $ ruleCheck ] ; if ( ! $ options [ 'contains' ] && ! empty ( $ ruleCheck ) ) { foreach ( $ ruleCheck as $ key => $ item ) { $ ruleCheck [ $ key ] = is_string ( $ item ) ? "/^{$item}$/" : $ item ; } } $ params = compact ( 'value' , 'format' , 'options' ) ; return Filters :: run ( get_called_class ( ) , $ rule , $ params , static :: _checkFormats ( $ ruleCheck ) ) ; }
Checks a single value against a single validation rule in one or more formats.

@param string $rule
@param mixed $value
@param string $format
@param array $options
@return boolean Returns `true` or `false` indicating whether the validation rule check
succeeded or failed.
@filter
Checks a single value against a single validation rule in one or more formats .