\google\appengine\api\users\User

FINAL

A user.

We provide the email address, nickname, and id for a user.

A nickname is a human-readable string which uniquely identifies a Google user, akin to a username. It will be an email address for some users, but not all.

A user could be a Google Accounts user or a federated login user.

Federated identity and federated provider are only avaliable for federated users.

Methods

__construct

__construct(string $email = null, string $federated_identity = null, string $federated_provider = null, $user_id = null)

Constructor.

Parameters

Name Description

$email

string

An optional string of the user's email address. It defaults to the current user's email address.

$federated_identity

string

The federated identity of user. It defaults to the current user's federated identity.

$federated_provider

string

The federated provider url of user.

$user_id

Throws

\InvalidArgumentException

Thrown if both email and federated identity are empty.

getNickname

getNickname() : string

Return this user's nickname.

The nickname will be a unique, human readable identifier for this user with respect to this application. It will be an email address for some users, part of the email address for some users, and the federated identity for federated users who have not asserted an email address.

Returns

string

The user's nickname.

getEmail

getEmail() : string

Return this user's email address.

Returns

string

The user's email address.

getUserId

getUserId() : string

Return either a permanent unique identifying string or null.

If the email address was set explicity, this will return null.

Returns

string

The user's UserId.

getAuthDomain

getAuthDomain() : string

Return this user's auth domain.

This method is internal and should not be used by client applications.

Returns

string

The user's authentication domain.

getFederatedIdentity

getFederatedIdentity() : string

Return this user's federated identity, null if not a federated user.

Returns

string

The user's federated identity.

getFederatedProvider

getFederatedProvider() : string

Return this user's federated provider, null if not a federated user.

Returns

string

The user's federated provider.

__toString

__toString() : string

Magic method that PHP uses when the object is treated like a string.

Returns

string

The attributes of this user.