1
0

IAttributes.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * @author Piotr Mrowczynski <piotr@owncloud.com>
  4. *
  5. * @copyright Copyright (c) 2019, ownCloud GmbH
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace OCP\Share;
  22. /**
  23. * Interface IAttributes
  24. *
  25. * @package OCP\Share
  26. * @since 25.0.0
  27. */
  28. interface IAttributes {
  29. /**
  30. * Sets an attribute enabled/disabled. If the key did not exist before it will be created.
  31. *
  32. * @param string $scope scope
  33. * @param string $key key
  34. * @param bool $enabled enabled
  35. * @return IAttributes The modified object
  36. * @since 25.0.0
  37. */
  38. public function setAttribute($scope, $key, $enabled);
  39. /**
  40. * Returns if attribute is enabled/disabled for given scope id and key.
  41. * If attribute does not exist, returns null
  42. *
  43. * @param string $scope scope
  44. * @param string $key key
  45. * @return bool|null
  46. * @since 25.0.0
  47. */
  48. public function getAttribute($scope, $key);
  49. /**
  50. * Formats the IAttributes object to array with the following format:
  51. * [
  52. * 0 => [
  53. * "scope" => <string>,
  54. * "key" => <string>,
  55. * "enabled" => <bool>
  56. * ],
  57. * ...
  58. * ]
  59. *
  60. * @return array formatted IAttributes
  61. * @since 25.0.0
  62. */
  63. public function toArray();
  64. }