UserVersion.php

  1. 8.0.x lib/Drush/User/UserVersion.php
  2. 7.x lib/Drush/User/UserVersion.php
  3. master lib/Drush/User/UserVersion.php

Namespace

Drush\User

Classes

Namesort descending Description
UserVersion

File

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