empty($incident->location->lat) === false && empty($incident->location->lng) === false, ); // Remove incidents without a date $incidents = array_filter( $incidents, fn (stdClass $incident): bool => empty($incident->timestamp) === false, ); usort($incidents, fn (stdClass $a, stdClass $b): int => $b->timestamp <=> $a->timestamp); return $incidents;