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

Automattic\WooCommerce\Admin\RemoteInboxNotifications

EvaluateAndGetStatus{} WC 1.0

Evaluates the spec and returns a status.

Хуков нет.

Возвращает

Null. Ничего.

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

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

Методы

  1. evaluate( $spec, $current_status, $stored_state, $rule_evaluator )

Код EvaluateAndGetStatus{} WC 4.6.1

<?php
class EvaluateAndGetStatus {
	/**
	 * Evaluates the spec and returns a status.
	 *
	 * @param array  $spec           The spec to evaluate.
	 * @param string $current_status The note's current status.
	 * @param object $stored_state   Stored state.
	 * @param object $rule_evaluator Evaluates rules into true/false.
	 *
	 * @return string The evaluated status.
	 */
	public static function evaluate( $spec, $current_status, $stored_state, $rule_evaluator ) {
		// No rules should leave the note alone.
		if ( ! isset( $spec->rules ) ) {
			return $current_status;
		}

		$evaluated_result = $rule_evaluator->evaluate( $spec->rules, $stored_state );

		// Pending notes should be the spec status if the spec passes,
		// left alone otherwise.
		if ( WC_Admin_Note::E_WC_ADMIN_NOTE_PENDING === $current_status ) {
			return $evaluated_result
				? $spec->status
				: WC_Admin_Note::E_WC_ADMIN_NOTE_PENDING;
		}

		// When allow_redisplay isn't set, just leave the note alone.
		if ( ! isset( $spec->allow_redisplay ) || ! $spec->allow_redisplay ) {
			return $current_status;
		}

		// allow_redisplay is set, unaction the note if eval to true.
		return $evaluated_result
			? WC_Admin_Note::E_WC_ADMIN_NOTE_UNACTIONED
			: $current_status;
	}
}