PHP Class yii\authclient\BaseClient

See also: ClientInterface
Since: 2.0
Author: Paul Klimov ([email protected])
Inheritance: extends yii\base\Component, implements yii\authclient\ClientInterface
Exibir arquivo Open project: yiisoft/yii2-authclient Class Usage Examples

Public Methods

Method Description
createRequest ( ) : Request Creates HTTP request instance.
getHttpClient ( ) : Client Returns HTTP client.
getId ( ) : string
getName ( ) : string
getNormalizeUserAttributeMap ( ) : array
getRequestOptions ( ) : array
getStateStorage ( ) : yii\authclient\StateStorageInterface
getTitle ( ) : string
getUserAttributes ( ) : array
getViewOptions ( ) : array
setHttpClient ( array | Client $httpClient ) Sets HTTP client to be used.
setId ( string $id )
setName ( string $name )
setNormalizeUserAttributeMap ( array $normalizeUserAttributeMap )
setRequestOptions ( array $options )
setStateStorage ( yii\authclient\StateStorageInterface | array | string $stateStorage )
setTitle ( string $title )
setUserAttributes ( array $userAttributes )
setViewOptions ( array $viewOptions )

Protected Methods

Method Description
createHttpClient ( string | array $reference ) : Client Creates HTTP client instance from reference or configuration.
defaultName ( ) : string Generates service name.
defaultNormalizeUserAttributeMap ( ) : array Returns the default [[normalizeUserAttributeMap]] value.
defaultRequestOptions ( ) : array Returns default HTTP request options.
defaultTitle ( ) : string Generates service title.
defaultViewOptions ( ) : array Returns the default [[viewOptions]] value.
getState ( string $key ) : mixed Returns persistent state value.
getStateKeyPrefix ( ) : string Returns session key prefix, which is used to store internal states.
initUserAttributes ( ) : array Initializes authenticated user attributes.
normalizeUserAttributes ( array $attributes ) : array Normalize given user attributes according to [[normalizeUserAttributeMap]].
removeState ( string $key ) : boolean Removes persistent state value.
setState ( string $key, mixed $value ) Sets persistent state.

Method Details

createHttpClient() protected method

Creates HTTP client instance from reference or configuration.
Since: 2.1
protected createHttpClient ( string | array $reference ) : Client
$reference string | array component name or array configuration.
return yii\httpclient\Client HTTP client instance.

createRequest() public method

Creates HTTP request instance.
Since: 2.1
public createRequest ( ) : Request
return yii\httpclient\Request HTTP request instance.

defaultName() protected method

Generates service name.
protected defaultName ( ) : string
return string service name.

defaultNormalizeUserAttributeMap() protected method

Particular client may override this method in order to provide specific default map.
protected defaultNormalizeUserAttributeMap ( ) : array
return array normalize attribute map.

defaultRequestOptions() protected method

Returns default HTTP request options.
Since: 2.1
protected defaultRequestOptions ( ) : array
return array HTTP request options.

defaultTitle() protected method

Generates service title.
protected defaultTitle ( ) : string
return string service title.

defaultViewOptions() protected method

Particular client may override this method in order to provide specific default view options.
protected defaultViewOptions ( ) : array
return array list of default [[viewOptions]]

getHttpClient() public method

Returns HTTP client.
Since: 2.1
public getHttpClient ( ) : Client
return yii\httpclient\Client internal HTTP client.

getId() public method

public getId ( ) : string
return string service id

getName() public method

public getName ( ) : string
return string service name.

getNormalizeUserAttributeMap() public method

public getNormalizeUserAttributeMap ( ) : array
return array normalize user attribute map.

getRequestOptions() public method

Since: 2.1
public getRequestOptions ( ) : array
return array HTTP request options.

getState() protected method

Returns persistent state value.
protected getState ( string $key ) : mixed
$key string state key.
return mixed state value.

getStateKeyPrefix() protected method

Returns session key prefix, which is used to store internal states.
protected getStateKeyPrefix ( ) : string
return string session key prefix.

getStateStorage() public method

public getStateStorage ( ) : yii\authclient\StateStorageInterface
return yii\authclient\StateStorageInterface stage storage.

getTitle() public method

public getTitle ( ) : string
return string service title.

getUserAttributes() public method

public getUserAttributes ( ) : array
return array list of user attributes

getViewOptions() public method

public getViewOptions ( ) : array
return array view options in format: optionName => optionValue

initUserAttributes() abstract protected method

Initializes authenticated user attributes.
abstract protected initUserAttributes ( ) : array
return array auth user attributes.

normalizeUserAttributes() protected method

Normalize given user attributes according to [[normalizeUserAttributeMap]].
protected normalizeUserAttributes ( array $attributes ) : array
$attributes array raw attributes.
return array normalized attributes.

removeState() protected method

Removes persistent state value.
protected removeState ( string $key ) : boolean
$key string state key.
return boolean success.

setHttpClient() public method

Sets HTTP client to be used.
Since: 2.1
public setHttpClient ( array | Client $httpClient )
$httpClient array | yii\httpclient\Client internal HTTP client.

setId() public method

public setId ( string $id )
$id string service id.

setName() public method

public setName ( string $name )
$name string service name.

setNormalizeUserAttributeMap() public method

public setNormalizeUserAttributeMap ( array $normalizeUserAttributeMap )
$normalizeUserAttributeMap array normalize user attribute map.

setRequestOptions() public method

Since: 2.1
public setRequestOptions ( array $options )
$options array HTTP request options.

setState() protected method

Sets persistent state.
protected setState ( string $key, mixed $value )
$key string state key.
$value mixed state value

setStateStorage() public method

public setStateStorage ( yii\authclient\StateStorageInterface | array | string $stateStorage )
$stateStorage yii\authclient\StateStorageInterface | array | string stage storage to be used.

setTitle() public method

public setTitle ( string $title )
$title string service title.

setUserAttributes() public method

public setUserAttributes ( array $userAttributes )
$userAttributes array list of user attributes

setViewOptions() public method

public setViewOptions ( array $viewOptions )
$viewOptions array view options in format: optionName => optionValue