2022-05-18 14:54:27 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2024-05-23 09:26:56 +02:00
|
|
|
* SPDX-FileCopyrightText: 2019 ownCloud GmbH
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2022-05-18 14:54:27 +02:00
|
|
|
*/
|
|
|
|
namespace OCP\Share;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface IAttributes
|
|
|
|
*
|
|
|
|
* @package OCP\Share
|
2022-05-25 09:55:22 +02:00
|
|
|
* @since 25.0.0
|
2022-05-18 14:54:27 +02:00
|
|
|
*/
|
|
|
|
interface IAttributes {
|
|
|
|
/**
|
2024-07-12 10:41:41 +02:00
|
|
|
* Sets an attribute. If the key did not exist before it will be created.
|
2022-05-18 14:54:27 +02:00
|
|
|
*
|
|
|
|
* @param string $scope scope
|
|
|
|
* @param string $key key
|
2024-07-05 14:27:49 +02:00
|
|
|
* @param bool|string|array|null $value value
|
2022-05-18 14:54:27 +02:00
|
|
|
* @return IAttributes The modified object
|
2022-05-25 09:55:22 +02:00
|
|
|
* @since 25.0.0
|
2022-05-18 14:54:27 +02:00
|
|
|
*/
|
2024-07-12 10:41:41 +02:00
|
|
|
public function setAttribute(string $scope, string $key, mixed $value): IAttributes;
|
2022-05-18 14:54:27 +02:00
|
|
|
|
|
|
|
/**
|
2024-07-12 10:41:41 +02:00
|
|
|
* Returns the attribute for given scope id and key.
|
2022-05-18 14:54:27 +02:00
|
|
|
* If attribute does not exist, returns null
|
|
|
|
*
|
|
|
|
* @param string $scope scope
|
|
|
|
* @param string $key key
|
2024-07-05 14:27:49 +02:00
|
|
|
* @return bool|string|array|null
|
2022-05-25 09:55:22 +02:00
|
|
|
* @since 25.0.0
|
2022-05-18 14:54:27 +02:00
|
|
|
*/
|
2024-07-12 10:41:41 +02:00
|
|
|
public function getAttribute(string $scope, string $key): mixed;
|
2022-05-18 14:54:27 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Formats the IAttributes object to array with the following format:
|
|
|
|
* [
|
|
|
|
* 0 => [
|
|
|
|
* "scope" => <string>,
|
|
|
|
* "key" => <string>,
|
2024-07-12 10:41:41 +02:00
|
|
|
* "value" => <bool|string|array|null>,
|
2022-05-18 14:54:27 +02:00
|
|
|
* ],
|
|
|
|
* ...
|
|
|
|
* ]
|
|
|
|
*
|
|
|
|
* @return array formatted IAttributes
|
2022-05-25 09:55:22 +02:00
|
|
|
* @since 25.0.0
|
2024-07-12 10:41:41 +02:00
|
|
|
* @since 30.0.0, `enabled` was renamed to `value`
|
2022-05-18 14:54:27 +02:00
|
|
|
*/
|
2024-07-12 10:41:41 +02:00
|
|
|
public function toArray(): array;
|
2022-05-18 14:54:27 +02:00
|
|
|
}
|