3 * @file src/Model/Storage/IStorage.php
4 * @brief Storage backend system
7 namespace Friendica\Model\Storage;
10 * @brief Interface for storage backends
15 * @brief Get data from backend
17 * @param string $reference Data reference
21 public function get(string $reference);
24 * @brief Put data in backend as $ref. If $ref is not defined a new reference is created.
26 * @param string $data Data to save
27 * @param string $reference Data reference. Optional.
29 * @return string Saved data reference
31 public function put(string $data, string $reference = "");
34 * @brief Remove data from backend
36 * @param string $reference Data reference
38 * @return boolean True on success
40 public function delete(string $reference);
43 * @brief Get info about storage options
47 * This method return an array with informations about storage options
48 * from which the form presented to the user is build.
50 * The returned array is:
53 * 'option1name' => [ ..info.. ],
54 * 'option2name' => [ ..info.. ],
58 * An empty array can be returned if backend doesn't have any options
60 * The info array for each option MUST be as follows:
63 * 'type', // define the field used in form, and the type of data.
64 * // one of 'checkbox', 'combobox', 'custom', 'datetime',
65 * // 'input', 'intcheckbox', 'password', 'radio', 'richtext'
66 * // 'select', 'select_raw', 'textarea', 'yesno'
68 * 'label', // Translatable label of the field
69 * 'value', // Current value
70 * 'help text', // Translatable description for the field
71 * extra data // Optional. Depends on 'type':
72 * // select: array [ value => label ] of choices
73 * // intcheckbox: value of input element
74 * // select_raw: prebuild html string of < option > tags
75 * // yesno: array [ 'label no', 'label yes']
78 * See https://github.com/friendica/friendica/wiki/Quick-Template-Guide
80 public function getOptions();
83 * @brief Validate and save options
85 * @param array $data Array [optionname => value] to be saved
87 * @return array Validation errors: [optionname => error message]
89 * Return array must be empty if no error.
91 public function saveOptions(array $data);
94 * The name of the backend
98 public function __toString();
101 * The name of the backend
105 public static function getName();