Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\user;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Defines the user data service interface.
|
Chris@0
|
7 */
|
Chris@0
|
8 interface UserDataInterface {
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Returns data stored for a user account.
|
Chris@0
|
12 *
|
Chris@0
|
13 * @param string $module
|
Chris@0
|
14 * The name of the module the data is associated with.
|
Chris@0
|
15 * @param int $uid
|
Chris@0
|
16 * (optional) The user account ID the data is associated with.
|
Chris@0
|
17 * @param string $name
|
Chris@0
|
18 * (optional) The name of the data key.
|
Chris@0
|
19 *
|
Chris@0
|
20 * @return mixed|array
|
Chris@0
|
21 * The requested user account data, depending on the arguments passed:
|
Chris@0
|
22 * - For $module, $name, and $uid, the stored value is returned, or NULL if
|
Chris@0
|
23 * no value was found.
|
Chris@0
|
24 * - For $module and $uid, an associative array is returned that contains
|
Chris@0
|
25 * the stored data name/value pairs.
|
Chris@0
|
26 * - For $module and $name, an associative array is returned whose keys are
|
Chris@0
|
27 * user IDs and whose values contain the stored values.
|
Chris@0
|
28 * - For $module only, an associative array is returned that contains all
|
Chris@0
|
29 * existing data for $module in all user accounts, keyed first by user ID
|
Chris@0
|
30 * and $name second.
|
Chris@0
|
31 */
|
Chris@0
|
32 public function get($module, $uid = NULL, $name = NULL);
|
Chris@0
|
33
|
Chris@0
|
34 /**
|
Chris@0
|
35 * Stores data for a user account.
|
Chris@0
|
36 *
|
Chris@0
|
37 * @param string $module
|
Chris@0
|
38 * The name of the module the data is associated with.
|
Chris@0
|
39 * @param int $uid
|
Chris@0
|
40 * The user account ID the data is associated with.
|
Chris@0
|
41 * @param string $name
|
Chris@0
|
42 * The name of the data key.
|
Chris@0
|
43 * @param mixed $value
|
Chris@0
|
44 * The value to store. Non-scalar values are serialized automatically.
|
Chris@0
|
45 */
|
Chris@0
|
46 public function set($module, $uid, $name, $value);
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * Deletes data stored for a user account.
|
Chris@0
|
50 *
|
Chris@0
|
51 * @param string|array $module
|
Chris@0
|
52 * (optional) The name of the module the data is associated with. Can also
|
Chris@0
|
53 * be an array to delete the data of multiple modules.
|
Chris@0
|
54 * @param int|array $uid
|
Chris@0
|
55 * (optional) The user account ID the data is associated with. If omitted,
|
Chris@0
|
56 * all data for $module is deleted. Can also be an array of IDs to delete
|
Chris@0
|
57 * the data of multiple user accounts.
|
Chris@0
|
58 * @param string $name
|
Chris@0
|
59 * (optional) The name of the data key. If omitted, all data associated with
|
Chris@0
|
60 * $module and $uid is deleted.
|
Chris@0
|
61 */
|
Chris@0
|
62 public function delete($module = NULL, $uid = NULL, $name = NULL);
|
Chris@0
|
63
|
Chris@0
|
64 }
|