PHP Class DfpUser, googleads-php-lib

Inheritance: extends AdsUser
显示文件 Open project: googleads/googleads-php-lib Class Usage Examples

Public Methods

Method Description
GetApplicationName ( ) : string Gets the raw application name for this user.
GetClientLibraryNameAndVersion ( )
GetDefaultOAuth2Handler ( null | string $className = null ) : mixed Get the default OAuth2 Handler for this user.
GetNetworkCode ( ) : string Gets the code for the network that this user belongs to.
GetScopes ( ) : array Gets OAuth2 scopes.
GetService ( string $serviceName, string $version = null, string $server = null, SoapClientFactory $serviceFactory = null ) : SoapClient Gets the service by its service name.
GetUserAgentHeaderName ( )
SetApplicationName ( string $applicationName ) Sets the raw application name for this user.
SetNetworkCode ( string $networkCode ) Sets the code for the network that this user belongs to.
SetScopes ( $scopes ) Sets OAuth2 scopes.
ValidateUser ( ) Validates the user and throws a validation error if there are any errors.
__call ( string $name, array $arguments ) : mixed Handles calls to undefined methods.
__construct ( string $authenticationIniPath = null, string $applicationName = null, string $networkCode = null, string $settingsIniPath = null, array $oauth2Info = null ) The DfpUser constructor.

Method Details

GetApplicationName() public method

Gets the raw application name for this user.
public GetApplicationName ( ) : string
return string The raw application name.

GetClientLibraryNameAndVersion() public method

See also: AdsUser::GetClientLibraryNameAndVersion()

GetDefaultOAuth2Handler() public method

Get the default OAuth2 Handler for this user.
public GetDefaultOAuth2Handler ( null | string $className = null ) : mixed
$className null | string the name of the oauth2Handler class or null
return mixed the configured OAuth2Handler class

GetNetworkCode() public method

Gets the code for the network that this user belongs to.
public GetNetworkCode ( ) : string
return string the network code

GetScopes() public method

Gets OAuth2 scopes.
public GetScopes ( ) : array
return array the list of OAuth2 scopes

GetService() public method

Gets the service by its service name.
public GetService ( string $serviceName, string $version = null, string $server = null, SoapClientFactory $serviceFactory = null ) : SoapClient
$serviceName string the service name
$version string the version of the service to get. If null, then the default version will be used
$server string the server to make the request to. If null, then the default server will be used
$serviceFactory SoapClientFactory the factory to create the client. If null, then the built-in SOAP client factory will be used
return SoapClient the instantiated service

GetUserAgentHeaderName() public method

See also: AdsUser::GetUserAgentHeaderName()

SetApplicationName() public method

Sets the raw application name for this user.
public SetApplicationName ( string $applicationName )
$applicationName string The raw application name.

SetNetworkCode() public method

Sets the code for the network that this user belongs to.
public SetNetworkCode ( string $networkCode )
$networkCode string the network code

SetScopes() public method

Sets OAuth2 scopes.
public SetScopes ( $scopes )

ValidateUser() public method

Validates the user and throws a validation error if there are any errors.
public ValidateUser ( )

__call() public method

Handles calls to undefined methods.
public __call ( string $name, array $arguments ) : mixed
$name string the name of the method being called
$arguments array the arguments passed to the method
return mixed the result of the correct method call, or nothing if there is no correct method

__construct() public method

The DfpUser class can be configured in one of two ways:

  1. Using an authentication INI file
  2. Using supplied credentials

If an authentication INI file is provided and successfully loaded, those values will be used unless a corresponding parameter overwrites it. If the authentication INI file is not provided (e.g. it is null) the class will attempt to load the default authentication file at the path of "../auth.ini" relative to this file's directory. Any corresponding parameter, which is not null will however, overwrite any parameter loaded from the default INI.

Likewise, if a custom settings INI file is not provided, the default settings INI file will be loaded from the path of "../settings.ini" relative to this file's directory.

public __construct ( string $authenticationIniPath = null, string $applicationName = null, string $networkCode = null, string $settingsIniPath = null, array $oauth2Info = null )
$authenticationIniPath string the absolute path to the authentication INI or relative to the current directory (cwd). If null, the default authentication INI file will attempt to be loaded
$applicationName string the application name (required header). Will be prepended with the library name and version. Will also overwrite the applicationName entry in any INI file
$networkCode string the network code the user belongs to (optional header). Can be left null if the user only belongs to one network. Will overwrite the networkCode entry in any INI file
$settingsIniPath string the path to the settings INI file. If null, the default settings INI file will be loaded
$oauth2Info array the OAuth 2.0 information to use for requests