diff --git a/core/modules/user/lib/Drupal/user/UserData.php b/core/modules/user/lib/Drupal/user/UserData.php index 13855d2..e607d87 100644 --- a/core/modules/user/lib/Drupal/user/UserData.php +++ b/core/modules/user/lib/Drupal/user/UserData.php @@ -12,7 +12,7 @@ /** * Defines the user data service. */ -class UserData { +class UserData implements UserDataInterface { /** * The database connection to use. @@ -32,26 +32,7 @@ public function __construct(Connection $connection) { } /** - * Returns data stored for a user account. - * - * @param string $module - * The name of the module the data is associated with. - * @param integer $uid - * (optional) The user account ID the data is associated with. - * @param string $name - * (optional) The name of the data key. - * - * @return mixed|array - * The requested user account data, depending on the arguments passed: - * - For $module, $name, and $uid, the stored data is returned, or NULL if - * no data was found. - * - For $module and $uid, an associative array is returned that contains - * the stored data name/value pairs. - * - For $module and $name, an associative array is returned whose keys are - * user IDs and whose values contain the stored data. - * - For $module only, an associative array is returned that contains all - * existing data for $module in all user accounts, keyed first by user ID - * and $name second. + * Implements \Drupal\user\UserDataInterface::get(). */ public function get($module, $uid = NULL, $name = NULL) { $query = $this->connection->select('users_data', 'ud') @@ -99,18 +80,7 @@ public function get($module, $uid = NULL, $name = NULL) { } /** - * Stores data for a user account. - * - * @param string $module - * The name of the module the data is associated with. - * @param integer $uid - * The user account ID the data is associated with. - * @param string $name - * The name of the data key. - * @param mixed $value - * The value to store. Non-scalar values are serialized automatically. - * - * @return void + * Implements \Drupal\user\UserDataInterface::set(). */ public function set($module, $uid, $name, $value) { $serialized = 0; @@ -132,20 +102,7 @@ public function set($module, $uid, $name, $value) { } /** - * Deletes data stored for a user account. - * - * @param string|array $module - * (optional) The name of the module the data is associated with. Can also - * be an array to delete the data of multiple modules. - * @param integer|array $uid - * (optional) The user account ID the data is associated with. If omitted, - * all data for $module is deleted. Can also be an array of IDs to delete - * the data of multiple user accounts. - * @param string $name - * (optional) The name of the data key. If omitted, all data associated with - * $module and $uid is deleted. - * - * @return void + * Implements \Drupal\user\UserDataInterface::delete(). */ public function delete($module = NULL, $uid = NULL, $name = NULL) { $query = $this->connection->delete('users_data'); diff --git a/core/modules/user/lib/Drupal/user/UserDataInterface.php b/core/modules/user/lib/Drupal/user/UserDataInterface.php new file mode 100644 index 0000000..a12eba5 --- /dev/null +++ b/core/modules/user/lib/Drupal/user/UserDataInterface.php @@ -0,0 +1,75 @@ +