IProvider.php 1.2 KB

123456789101112131415161718192021222324252627282930
  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. use OCP\Activity\Exceptions\UnknownActivityException;
  8. /**
  9. * Interface IProvider
  10. *
  11. * @since 11.0.0
  12. */
  13. interface IProvider {
  14. /**
  15. * @param string $language The language which should be used for translating, e.g. "en"
  16. * @param IEvent $event The current event which should be parsed
  17. * @param IEvent|null $previousEvent A potential previous event which you can combine with the current one.
  18. * To do so, simply use setChildEvent($previousEvent) after setting the
  19. * combined subject on the current event.
  20. * @return IEvent
  21. * @throws UnknownActivityException Should be thrown if your provider does not know this event
  22. * @since 11.0.0
  23. * @since 30.0.0 Providers should throw {@see UnknownActivityException} instead of \InvalidArgumentException
  24. * when they did not handle the event. Throwing \InvalidArgumentException directly is deprecated and will
  25. * be logged as an error in Nextcloud 39.
  26. */
  27. public function parse($language, IEvent $event, ?IEvent $previousEvent = null);
  28. }