Automattic\WooCommerce\Internal\Abilities

AbilitiesTracking::flush_events │ private │ WC 1.0

Hand the recorded events to the Tracks client.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->flush_events(): void;

Код AbilitiesTracking::flush_events() WC 11.3.0

private function flush_events(): void {
	// Runs on shutdown, where an exception would also stop later shutdown callbacks.
	try {
		$last = array_key_last( $this->events );
		if ( null !== $last && $this->events_dropped > 0 ) {
			$this->events[ $last ]['events_dropped'] = $this->events_dropped;
			$this->events_dropped                    = 0;
		}

		$events       = $this->events;
		$this->events = array();
	} catch ( \Throwable $e ) {
		unset( $e );
		return;
	}

	foreach ( $events as $properties ) {
		try {
			$this->send_event( $properties );
		} catch ( \Throwable $e ) {
			unset( $e );
		}
	}
}