ILanguageIterator.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\L10N;
  7. /**
  8. * Interface ILanguageIterator
  9. *
  10. * iterator across language settings (if provided) in this order:
  11. * 1. returns the forced language or:
  12. * 2. if applicable, the trunk of 1 (e.g. "fu" instead of "fu_BAR"
  13. * 3. returns the user language or:
  14. * 4. if applicable, the trunk of 3
  15. * 5. returns the system default language or:
  16. * 6. if applicable, the trunk of 5
  17. * 7+∞. returns 'en'
  18. *
  19. * if settings are not present or truncating is not applicable, the iterator
  20. * skips to the next valid item itself
  21. *
  22. *
  23. * @since 14.0.0
  24. */
  25. interface ILanguageIterator extends \Iterator {
  26. /**
  27. * Return the current element
  28. *
  29. * @since 14.0.0
  30. */
  31. public function current(): string;
  32. /**
  33. * Move forward to next element
  34. *
  35. * @since 14.0.0
  36. * @return void
  37. */
  38. #[\ReturnTypeWillChange]
  39. public function next();
  40. /**
  41. * Return the key of the current element
  42. *
  43. * @since 14.0.0
  44. */
  45. public function key():int;
  46. /**
  47. * Checks if current position is valid
  48. *
  49. * @since 14.0.0
  50. */
  51. public function valid():bool;
  52. }