IEventMerger.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\Activity;
  7. /**
  8. * Interface EventMerger
  9. *
  10. * @since 11.0
  11. */
  12. interface IEventMerger {
  13. /**
  14. * Combines two events when possible to have grouping:
  15. *
  16. * Example1: Two events with subject '{user} created {file}' and
  17. * $mergeParameter file with different file and same user will be merged
  18. * to '{user} created {file1} and {file2}' and the childEvent on the return
  19. * will be set, if the events have been merged.
  20. *
  21. * Example2: Two events with subject '{user} created {file}' and
  22. * $mergeParameter file with same file and same user will be merged to
  23. * '{user} created {file1}' and the childEvent on the return will be set, if
  24. * the events have been merged.
  25. *
  26. * The following requirements have to be met, in order to be merged:
  27. * - Both events need to have the same `getApp()`
  28. * - Both events must not have a message `getMessage()`
  29. * - Both events need to have the same subject `getSubject()`
  30. * - Both events need to have the same object type `getObjectType()`
  31. * - The time difference between both events must not be bigger then 3 hours
  32. * - Only up to 5 events can be merged.
  33. * - All parameters apart from such starting with $mergeParameter must be
  34. * the same for both events.
  35. *
  36. * @param string $mergeParameter
  37. * @param IEvent $event
  38. * @param IEvent|null $previousEvent
  39. * @return IEvent
  40. * @since 11.0
  41. */
  42. public function mergeEvents($mergeParameter, IEvent $event, ?IEvent $previousEvent = null);
  43. }