e7649a213e8351608497a6708e77e208744c4d9d
[yaffs-website] / vendor / drush / drush / lib / Drush / User / UserVersion.php
1 <?php
2
3 namespace Drush\User;
4
5 abstract class UserVersion {
6
7   /**
8    * Create a new user account.
9    *
10    * @param array $properties
11    *
12    * @return
13    *   A user object.
14    */
15   public function create($properties) {}
16
17   /**
18    * Attempt to load a user account.
19    *
20    * @param int $uid
21    * @return mixed
22    */
23   public function load_by_uid($uid) {
24     return user_load($uid);
25   }
26
27   /**
28    * Attempt to load a user account.
29    *
30    * @param string $name
31    * @return mixed
32    */
33   public function load_by_name($name) {
34     return user_load_by_name($name);
35   }
36
37   /**
38    * Attempt to load a user account.
39    *
40    * @param string $mail
41    * @return mixed
42    */
43   public function load_by_mail($mail) {
44     return user_load_by_mail($mail);
45   }
46
47   /**
48    * Load the current user account.
49    *
50    * @return mixed
51    *   A user object.
52    */
53   public function getCurrentUserAsAccount() {
54     global $user;
55     return $user;
56   }
57
58   /**
59    * Load the current user account and return a UserSingle instance.
60    *
61    * @return \Drush\User\UserSingleBase
62    *   A Drush UserSingle instance.
63    */
64   public function getCurrentUserAsSingle() {
65     return drush_usersingle_get_class($this->getCurrentUserAsAccount());
66   }
67
68   /**
69    * Set the current "global" user account in Drupal.
70
71    * @param
72    *   A user object.
73    */
74   public function setCurrentUser($account) {
75     global $user;
76     $user = $account;
77   }
78 }