IAttributes.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2019 ownCloud GmbH
  4. * SPDX-License-Identifier: AGPL-3.0-only
  5. */
  6. namespace OCP\Share;
  7. /**
  8. * Interface IAttributes
  9. *
  10. * @package OCP\Share
  11. * @since 25.0.0
  12. */
  13. interface IAttributes {
  14. /**
  15. * Sets an attribute enabled/disabled. If the key did not exist before it will be created.
  16. *
  17. * @param string $scope scope
  18. * @param string $key key
  19. * @param bool $enabled enabled
  20. * @return IAttributes The modified object
  21. * @since 25.0.0
  22. */
  23. public function setAttribute($scope, $key, $enabled);
  24. /**
  25. * Returns if attribute is enabled/disabled for given scope id and key.
  26. * If attribute does not exist, returns null
  27. *
  28. * @param string $scope scope
  29. * @param string $key key
  30. * @return bool|null
  31. * @since 25.0.0
  32. */
  33. public function getAttribute($scope, $key);
  34. /**
  35. * Formats the IAttributes object to array with the following format:
  36. * [
  37. * 0 => [
  38. * "scope" => <string>,
  39. * "key" => <string>,
  40. * "enabled" => <bool>
  41. * ],
  42. * ...
  43. * ]
  44. *
  45. * @return array formatted IAttributes
  46. * @since 25.0.0
  47. */
  48. public function toArray();
  49. }