abstract class UserVersion

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

Namespace

Drush\User

Hierarchy

Expanded class hierarchy of UserVersion

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
UserVersion::create public function Create a new user account.
UserVersion::getCurrentUserAsAccount public function Load the current user account.
UserVersion::getCurrentUserAsSingle public function Load the current user account and return a UserSingle instance.
UserVersion::load_by_mail public function Attempt to load a user account.
UserVersion::load_by_name public function Attempt to load a user account.
UserVersion::load_by_uid public function Attempt to load a user account.
UserVersion::setCurrentUser public function Set the current "global" user account in Drupal.

File

lib/Drush/User/UserVersion.php, line 5

View source
abstract class UserVersion {

  /**
   * Create a new user account.
   *
   * @param array $properties
   *
   * @return
   *   A user object.
   */
  public function create($properties) {
  }

  /**
   * Attempt to load a user account.
   *
   * @param int $uid
   * @return mixed
   */
  public function load_by_uid($uid) {
    return user_load($uid);
  }

  /**
   * Attempt to load a user account.
   *
   * @param string $name
   * @return mixed
   */
  public function load_by_name($name) {
    return user_load_by_name($name);
  }

  /**
   * Attempt to load a user account.
   *
   * @param string $mail
   * @return mixed
   */
  public function load_by_mail($mail) {
    return user_load_by_mail($mail);
  }

  /**
   * Load the current user account.
   *
   * @return mixed
   *   A user object.
   */
  public function getCurrentUserAsAccount() {
    global $user;
    return $user;
  }

  /**
   * Load the current user account and return a UserSingle instance.
   *
   * @return \Drush\User\UserSingleBase
   *   A Drush UserSingle instance.
   */
  public function getCurrentUserAsSingle() {
    return drush_usersingle_get_class($this->getCurrentUserAsAccount());
  }

  /**
   * Set the current "global" user account in Drupal.

   * @param
   *   A user object.
   */
  public function setCurrentUser($account) {
    global $user;
    $user = $account;
  }
}