warnings as $warning ) { $message = $warning['message']; if ( preg_match( '/^Failed to import event (.+?): /s', $message, $match ) === 1 && preg_match( self::DUPLICATE_KEY, $message ) === 1 ) { ++$collision; $warnings[] = [ 'line' => $warning['line'], 'message' => sprintf( // translators: %s is the event's iCalendar UID. __( 'Skipped event %s: its UID belongs to another calendar.', 'agenticdaisy-calendar' ), $match[1] ), ]; continue; } $warnings[] = $warning; } if ( 0 === $collision ) { return $result; } return new ImportResult( $result->importedCount, $result->skippedCount + $collision, $warnings, $result->updatedCount ); } }