1
0

IAccountPropertyCollection.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2021 Arthur Schiwon <blizzz@arthur-schiwon.de>
  5. *
  6. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\Accounts;
  25. use InvalidArgumentException;
  26. use JsonSerializable;
  27. /**
  28. * Interface IAccountPropertyCollection
  29. *
  30. * @package OCP\Accounts
  31. *
  32. * @since 22.0.0
  33. */
  34. interface IAccountPropertyCollection extends JsonSerializable {
  35. /**
  36. * returns the collection name
  37. *
  38. * @since 22.0.0
  39. */
  40. public function getName(): string;
  41. /**
  42. * set properties of this collection
  43. *
  44. * @param IAccountProperty[] $properties
  45. * @throws InvalidArgumentException
  46. * @since 22.0.0
  47. */
  48. public function setProperties(array $properties): IAccountPropertyCollection;
  49. /**
  50. * @return IAccountProperty[]
  51. * @since 22.0.0
  52. */
  53. public function getProperties(): array;
  54. /**
  55. * adds a property to this collection
  56. *
  57. * @throws InvalidArgumentException
  58. * @since 22.0.0
  59. */
  60. public function addProperty(IAccountProperty $property): IAccountPropertyCollection;
  61. /**
  62. * adds a property to this collection with only specifying the value
  63. *
  64. * @throws InvalidArgumentException
  65. * @since 22.0.0
  66. */
  67. public function addPropertyWithDefaults(string $value): IAccountPropertyCollection;
  68. /**
  69. * removes a property of this collection
  70. *
  71. * @since 22.0.0
  72. */
  73. public function removeProperty(IAccountProperty $property): IAccountPropertyCollection;
  74. /**
  75. * removes a property identified by its value
  76. *
  77. * @since 22.0.0
  78. */
  79. public function removePropertyByValue(string $value): IAccountPropertyCollection;
  80. /**
  81. * retrieves a property identified by its value. null, if none was found.
  82. *
  83. * Returns only the first property if there are more with the same value.
  84. *
  85. * @since 23.0.0
  86. */
  87. public function getPropertyByValue(string $value): ?IAccountProperty;
  88. }