Automattic\WooCommerce\Internal\Abilities
AbilitiesTracking::flush_events
Hand the recorded events to the Tracks client.
Method of the class: AbilitiesTracking{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->flush_events(): void;
AbilitiesTracking::flush_events() AbilitiesTracking::flush events code 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 );
}
}
}