HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ubuntu-8gb-hel1-1 6.8.0-55-generic #57-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 12 23:42:21 UTC 2025 x86_64
User: www-data (33)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: /var/www/agighana.org_backup/Event_List.php
<?php
/**
 * Class Google\Site_Kit\Modules\Analytics_4\Advanced_Tracking\Event_List
 *
 * @package   Google\Site_Kit
 * @copyright 2024 Google LLC
 * @license   https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      https://sitekit.withgoogle.com
 */

namespace Google\Site_Kit\Modules\Analytics_4\Advanced_Tracking;

/**
 * Base class representing a tracking event list.
 *
 * @since 1.18.0.
 * @since 1.121.0 Migrated from the Analytics (UA) namespace.
 * @access private
 * @ignore
 */
abstract class Event_List {

	/**
	 * Container for events.
	 *
	 * @since 1.18.0.
	 * @var array Map of events for this list, keyed by their unique ID.
	 */
	private $events = array();

	/**
	 * Adds events or registers WordPress hook callbacks to add events.
	 *
	 * Children classes should extend this to add their events, either generically or by dynamically collecting
	 * metadata through WordPress hooks.
	 *
	 * @since 1.18.0.
	 */
	abstract public function register();

	/**
	 * Adds a measurement event to the measurement events array.
	 *
	 * @since 1.18.0.
	 *
	 * @param Event $event The measurement event object.
	 */
	protected function add_event( Event $event ) {
		$hash                  = md5( wp_json_encode( $event ) );
		$this->events[ $hash ] = $event;
	}

	/**
	 * Gets the measurement events array.
	 *
	 * @since 1.18.0.
	 *
	 * @return array The map of events for this list, keyed by their unique ID.
	 */
	public function get_events() {
		return $this->events;
	}
}