Automattic\WooCommerce\Internal\PushNotifications\Services

StepLogQuery::strip_unrelated_tokens │ private static │ WC 1.0

Returns the row for one token, with every other token's data removed.

The stored line names every token the notification touched, so the three token lists are dropped and the step and outcome are replaced with what happened to this one. Two rows built from the same line can therefore carry different outcomes.

Метод класса: StepLogQuery{}

Хуков нет.

Возвращает

array.

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

$result = StepLogQuery::strip_unrelated_tokens( $row, $token_id, $step, $outcome ): array;
$row(массив) (обязательный)
The stored row.
$token_id(int) (обязательный)
The token to keep.
$step(строка) (обязательный)
The step to report for that token.
$outcome(строка) (обязательный)
The outcome to report for that token.

Код StepLogQuery::strip_unrelated_tokens() WC 11.3.0

private static function strip_unrelated_tokens( array $row, int $token_id, string $step, string $outcome ): array {
	$context = $row['context'] ?? array();

	unset( $context['excluded_tokens'], $context['invalid_token_ids'], $context['token_ids'] );

	$context['token_id'] = $token_id;
	$context['step']     = $step;
	$context['outcome']  = $outcome;

	$row['context'] = $context;
	$row['message'] = ucfirst( str_replace( '_', ' ', $step ) ) . ': ' . str_replace( '_', ' ', $outcome );

	return $row;
}