WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
класс не описан

Automattic\WooCommerce\Admin\RemoteInboxNotifications

RuleEvaluator{} WC 1.0

Evaluate the given rules as an AND operation - return false early if a rule evaluates to false.

Хуков нет.

Возвращает

Null. Ничего.

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

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

Методы

  1. __construct( $get_rule_processor = null )
  2. evaluate( $rules, $stored_state )

Код RuleEvaluator{} WC 4.6.1

<?php
class RuleEvaluator {
	/**
	 * Constructor.
	 *
	 * @param GetRuleProcessor $get_rule_processor The GetRuleProcessor to use.
	 */
	public function __construct( $get_rule_processor = null ) {
		$this->get_rule_processor = null === $get_rule_processor
			? new GetRuleProcessor()
			: $get_rule_processor;
	}

	/**
	 * Evaluate the given rules as an AND operation - return false early if a
	 * rule evaluates to false.
	 *
	 * @param array|object $rules        The rule or rules being processed.
	 * @param object       $stored_state Stored state.
	 *
	 * @return bool The result of the operation.
	 */
	public function evaluate( $rules, $stored_state ) {
		if ( ! is_array( $rules ) ) {
			$rules = array( $rules );
		}

		if ( 0 === count( $rules ) ) {
			return false;
		}

		foreach ( $rules as $rule ) {
			$processor        = $this->get_rule_processor->get_processor( $rule->type );
			$processor_result = $processor->process( $rule, $stored_state );

			if ( ! $processor_result ) {
				return false;
			}
		}

		return true;
	}
}