WPCF7_SWV_Schema{}CF7 1.0

The schema class as a composite rule.

Хуков нет.

Использование

$WPCF7_SWV_Schema = new WPCF7_SWV_Schema();
// use class methods

Методы

  1. public __construct( $properties = '' )
  2. public validate( $context )

Код WPCF7_SWV_Schema{} CF7 5.9.7

class WPCF7_SWV_Schema extends \Contactable\SWV\CompositeRule {

	/**
	 * The human-readable version of the schema.
	 */
	const version = 'Contact Form 7 SWV Schema 2024-02';


	/**
	 * Constructor.
	 */
	public function __construct( $properties = '' ) {
		$this->properties = wp_parse_args( $properties, array(
			'version' => self::version,
		) );
	}


	/**
	 * Validates with this schema.
	 *
	 * @param array $context Context.
	 */
	public function validate( $context ) {
		foreach ( $this->rules() as $rule ) {
			if ( $rule->matches( $context ) ) {
				yield $rule->validate( $context );
			}
		}
	}

}