Code Duplication    Length = 15-15 lines in 2 locations

packages/tracking/src/Tracking.php 1 location

@@ 66-80 (lines=15) @@
63
	 *
64
	 * @return bool true for success | \WP_Error if the event pixel could not be fired
65
	 */
66
	function tracks_record_event( $user, $event_name, $properties = array(), $event_timestamp_millis = false ) {
67
68
		// We don't want to track user events during unit tests/CI runs.
69
		if ( $user instanceof \WP_User && 'wptests_capabilities' === $user->cap_key ) {
70
			return false;
71
		}
72
73
		$event_obj = $this->tracks_build_event_obj( $user, $event_name, $properties, $event_timestamp_millis );
74
75
		if ( is_wp_error( $event_obj->error ) ) {
76
			return $event_obj->error;
77
		}
78
79
		return $event_obj->record();
80
	}
81
82
	/**
83
	 * Procedurally build a Tracks Event Object.

_inc/lib/tracks/client.php 1 location

@@ 126-140 (lines=15) @@
123
 *
124
 * @deprecated 7.5.0 use Automattic\Jetpack\Tracking->tracks_record_event instead
125
 */
126
function jetpack_tracks_record_event( $user, $event_name, $properties = array(), $event_timestamp_millis = false ) {
127
	// @TODO: Enable these once we're sure that we won't be flooding sites with notices.
128
	//_doing_it_wrong( 'jetpack_tracks_record_event', 'Use Automattic\Jetpack\Tracking::tracks_record_event instead.', '7.5.0' );
129
130
	// We don't want to track user events during unit tests/CI runs.
131
	if ( $user instanceof WP_User && 'wptests_capabilities' === $user->cap_key ) {
132
		return false;
133
	}
134
135
	$event_obj = jetpack_tracks_build_event_obj( $user, $event_name, $properties, $event_timestamp_millis );
136
137
	if ( is_wp_error( $event_obj->error ) ) {
138
		return $event_obj->error;
139
	}
140
141
	return $event_obj->record();
142
}
143