IAccountPropertyCollection.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Accounts;
  8. use InvalidArgumentException;
  9. use JsonSerializable;
  10. /**
  11. * Interface IAccountPropertyCollection
  12. *
  13. * @package OCP\Accounts
  14. *
  15. * @since 22.0.0
  16. */
  17. interface IAccountPropertyCollection extends JsonSerializable {
  18. /**
  19. * returns the collection name
  20. *
  21. * @since 22.0.0
  22. */
  23. public function getName(): string;
  24. /**
  25. * set properties of this collection
  26. *
  27. * @param IAccountProperty[] $properties
  28. * @throws InvalidArgumentException
  29. * @since 22.0.0
  30. */
  31. public function setProperties(array $properties): IAccountPropertyCollection;
  32. /**
  33. * @return IAccountProperty[]
  34. * @since 22.0.0
  35. */
  36. public function getProperties(): array;
  37. /**
  38. * adds a property to this collection
  39. *
  40. * @throws InvalidArgumentException
  41. * @since 22.0.0
  42. */
  43. public function addProperty(IAccountProperty $property): IAccountPropertyCollection;
  44. /**
  45. * adds a property to this collection with only specifying the value
  46. *
  47. * @throws InvalidArgumentException
  48. * @since 22.0.0
  49. */
  50. public function addPropertyWithDefaults(string $value): IAccountPropertyCollection;
  51. /**
  52. * removes a property of this collection
  53. *
  54. * @since 22.0.0
  55. */
  56. public function removeProperty(IAccountProperty $property): IAccountPropertyCollection;
  57. /**
  58. * removes a property identified by its value
  59. *
  60. * @since 22.0.0
  61. */
  62. public function removePropertyByValue(string $value): IAccountPropertyCollection;
  63. /**
  64. * retrieves a property identified by its value. null, if none was found.
  65. *
  66. * Returns only the first property if there are more with the same value.
  67. *
  68. * @since 23.0.0
  69. */
  70. public function getPropertyByValue(string $value): ?IAccountProperty;
  71. }