IAttributes.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. }