Abstract_REST_Endpoint::get_mapped_events_from_queue( TECEvent_AutomatorZapierRESTV1Endpointsarray $current_queue, bool $add_updated_id, string $empty_code, string $no_valid_code )
Retrieves a list of mapped events from the specified queue.
Contents
Parameters
- $current_queue
-
(<span class="TECEvent_AutomatorZapierRESTV1EndpointsarrayTECEvent_AutomatorZapierRESTV1Endpointsarray<string|">TECEvent_AutomatorZapierRESTV1Endpointsmixed>) (Required) The queue of event IDs to be processed.
- $add_updated_id
-
(bool) (Required) Whether to add updated IDs to the events array.
- $empty_code
-
(string) (Required) The code to return if the current queue is empty.
- $no_valid_code
-
(string) (Required) The code to return if no valid events are found.
Return
(TECEvent_AutomatorZapierRESTV1Endpointsarray<string|TECEvent_AutomatorZapierRESTV1Endpointsmixed>) An array of mapped attendees or an array with a specific 'id' code.
Source
File: src/Common/Event_Automator/Zapier/REST/V1/Endpoints/Abstract_REST_Endpoint.php
public function get_mapped_events_from_queue( $current_queue, bool $add_updated_id, string $empty_code, string $no_valid_code ) {
if ( empty( $current_queue ) ) {
return [ [ 'id' => $empty_code ] ];
}
$events = [];
foreach ( $current_queue as $next_event_id ) {
// Ensure that $next_event_id is numeric before typecasting to integer.
if ( ! is_numeric( $next_event_id ) ) {
continue;
}
$next_event_id = (int) $next_event_id;
$next_event = $this->get_mapped_event( $next_event_id, $add_updated_id );
if ( empty( $next_event ) ) {
continue;
}
$events[] = $next_event;
}
return ! empty( $events ) ? $events : [ [ 'id' => $no_valid_code ] ];
}
Changelog
| Version | Description |
|---|---|
| 6.0.0 | Introduced. |