class User (View source)

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($email = null, $federated_identity = null, $federated_provider = null, $user_id = null)

Constructor.

string
getNickname()

Return this user's nickname.

string
getEmail()

Return this user's email address.

string
getUserId()

Return either a permanent unique identifying string or null.

string
getAuthDomain()

Return this user's auth domain.

string
getFederatedIdentity()

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

string
getFederatedProvider()

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

string
__toString()

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

Details

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

Constructor.

Parameters

$email
$federated_identity
$federated_provider
$user_id

Exceptions

InvalidArgumentException Thrown if both email and federated identity are empty.

string getNickname()

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.

Return Value

string The user's nickname.

string getEmail()

Return this user's email address.

Return Value

string The user's email address.

string getUserId()

Return either a permanent unique identifying string or null.

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

Return Value

string The user's UserId.

string getAuthDomain()

Return this user's auth domain.

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

Return Value

string The user's authentication domain.

string getFederatedIdentity()

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

Return Value

string The user's federated identity.

string getFederatedProvider()

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

Return Value

string The user's federated provider.

string __toString()

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

Return Value

string The attributes of this user.