PHP Class AdsUser, googleads-php-lib

Afficher le fichier Open project: googleads/googleads-php-lib Class Usage Examples

Méthodes publiques

Méthode Description
GetClientLibraryUserAgent ( ) : string Gets the user agent string that identifies this library for this user.
GetDefaultOAuth2Handler ( null | string $className = null ) : mixed Get the default OAuth2 Handler for this user.
GetDefaultServer ( ) : string Gets the default server.
GetDefaultVersion ( ) : string Gets the default version.
GetForceAddXsiTypes ( ) : boolean Gets the setting of whether or not to add XSI types in the SOAP payload.
GetForceHttpVersion ( ) : float Gets the version of the HTTP protocol to use regardless of PHP version.
GetHeaderNames ( ) : array Gets the names of all registered request header elements.
GetHeaderValue ( string $key ) : string Gets the value for a registered request header element.
GetLogsDirectory ( ) : string Gets the logs directory.
GetOAuth2Handler ( ) : OAuth2Handler Gets the OAuth2 handler for this user.
GetOAuth2Info ( ) : array Gets the OAuth2 info for this user.
GetServiceSoapClient ( string $serviceName, SoapClientFactory $serviceFactory ) : SoapClient Gets the service by its service name.
GetSoapCompressionLevel ( ) : integer Gets the SOAP compression level.
GetWsdlCacheType ( ) : integer Gets the type of WSDL caching in use.
IsSoapCompressionEnabled ( ) : boolean Is SOAP compression enabled.
LoadSettings ( string $settingsIniPath, string $defaultVersion, string $defaultServer, string $defaultLogsDir, string $logsRelativePathBase ) Loads the settings for this client library. If the settings INI file located at $settingsIniPath cannot be loaded, then the parameters passed into this method are used.
LogAll ( ) Configures the library to log all requests.
LogDefaults ( ) Configures the library to log basic information about all requests and the full SOAP XML request and response only when an error occurs.
LogErrors ( ) Configures the library to only log requests that return an error.
SetDefaultServer ( string $defaultServer ) Sets the default server.
SetDefaultVersion ( string $defaultVersion ) Sets the default version.
SetHeaderValue ( string $key, string $value ) Sets the value for a request header.
SetOAuth2Handler ( array $oauth2Handler ) Sets the OAuth2 handler for this user.
SetOAuth2Info ( array $oauth2Info ) Sets the OAuth2 info for this user.
getIsIncludeUtilitiesInUserAgent ( ) : boolean
setIncludeUtilitiesInUserAgent ( boolean $isIncludeUtilitiesInUserAgent )
updateClientLibraryUserAgent ( string $applicationName ) Sets the user agent string that identifies this library for this user.

Méthodes protégées

Méthode Description
GetAuthVarValue ( string | null $authVar, string $authVarName, array $authIni ) : string Gets the authenticaiton value for the $authVar supplied. If the $authVar is set, it is is used. Otherwise, the supplied $authenticationIni is queried for the variable. If none is found null is returned.
GetClientLibraryNameAndVersion ( ) : array Gets the name and version of this client library.
GetUserAgentHeaderName ( ) : string Gets the appropriate user agent header name for the API this client library is targeting.
InitLogs ( ) Initializes the logging mechanism used by services created by this user.
ValidateOAuth2Info ( ) Validates that the OAuth2 info is complete.
__construct ( ) Constructor for AdsUser.

Private Methods

Méthode Description
Define ( string $name, string $value ) Define a constant if it isn't already defined. If it is defined but the value is different then attempt to redefine it, which will fail and throw the appropriate error.
GetAllClientLibraryUserAgentParts ( ) : array Gets all the user agent parts that identify this client library plus user agent parts from the ads utilities registry.
GetCommonClientLibraryUserAgentParts ( ) : array Gets common PHP user agent parts for ads client libraries such as PHP version, operating system, browser, or if compression is being used or not.
GetSetting ( array $settings, string $section, string $name, mixed $default = null ) : string Gets the value for a given setting based on the contents of the parsed INI file.

Method Details

GetAuthVarValue() protected méthode

Gets the authenticaiton value for the $authVar supplied. If the $authVar is set, it is is used. Otherwise, the supplied $authenticationIni is queried for the variable. If none is found null is returned.
protected GetAuthVarValue ( string | null $authVar, string $authVarName, array $authIni ) : string
$authVar string | null the default value for the authentication variable
$authVarName string the name of the authentication variable
$authIni array the array of authentication variables from an INI file
Résultat string the authentication variable value

GetClientLibraryNameAndVersion() abstract protected méthode

Gets the name and version of this client library.
abstract protected GetClientLibraryNameAndVersion ( ) : array
Résultat array An array containing the name and version of this client library, e.g.: ['DfpApi-PHP', '2.13.0'].

GetClientLibraryUserAgent() public méthode

Gets the user agent string that identifies this library for this user.
public GetClientLibraryUserAgent ( ) : string
Résultat string A user agent string.

GetDefaultOAuth2Handler() abstract public méthode

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

GetDefaultServer() public méthode

Gets the default server.
public GetDefaultServer ( ) : string
Résultat string the default server

GetDefaultVersion() public méthode

Gets the default version.
public GetDefaultVersion ( ) : string
Résultat string the default version

GetForceAddXsiTypes() public méthode

Gets the setting of whether or not to add XSI types in the SOAP payload.
public GetForceAddXsiTypes ( ) : boolean
Résultat boolean whether or not to add XSI types in the SOAP payload

GetForceHttpVersion() public méthode

Gets the version of the HTTP protocol to use regardless of PHP version.
public GetForceHttpVersion ( ) : float
Résultat float the HTTP version that should be used

GetHeaderNames() public méthode

Gets the names of all registered request header elements.
public GetHeaderNames ( ) : array
Résultat array the names of the request header elements

GetHeaderValue() public méthode

Gets the value for a registered request header element.
public GetHeaderValue ( string $key ) : string
$key string the name of the request header element
Résultat string the value of the request header element or null if not found

GetLogsDirectory() public méthode

Gets the logs directory.
public GetLogsDirectory ( ) : string
Résultat string the logs directory

GetOAuth2Handler() public méthode

Gets the OAuth2 handler for this user.
public GetOAuth2Handler ( ) : OAuth2Handler
Résultat OAuth2Handler the OAuth2 handler for this user

GetOAuth2Info() public méthode

Gets the OAuth2 info for this user.
public GetOAuth2Info ( ) : array
Résultat array the OAuth2 info for this user

GetServiceSoapClient() public méthode

Gets the service by its service name.
public GetServiceSoapClient ( string $serviceName, SoapClientFactory $serviceFactory ) : SoapClient
$serviceName string the service name
$serviceFactory SoapClientFactory the service factory
Résultat SoapClient the instantiated service

GetSoapCompressionLevel() public méthode

Gets the SOAP compression level.
public GetSoapCompressionLevel ( ) : integer
Résultat integer the SOAP compression level

GetUserAgentHeaderName() abstract protected méthode

Gets the appropriate user agent header name for the API this client library is targeting.
abstract protected GetUserAgentHeaderName ( ) : string
Résultat string The user agent header name.

GetWsdlCacheType() public méthode

Gets the type of WSDL caching in use.
public GetWsdlCacheType ( ) : integer
Résultat integer the type of WSDL caching in use

InitLogs() protected méthode

HTTP headers and SOAP XML are logged to the soap_xml.log file and all request information is logged to the request_info.log file under the logs directory.
protected InitLogs ( )

IsSoapCompressionEnabled() public méthode

Is SOAP compression enabled.
public IsSoapCompressionEnabled ( ) : boolean
Résultat boolean is SOAP compression enabled

LoadSettings() public méthode

Loads the settings for this client library. If the settings INI file located at $settingsIniPath cannot be loaded, then the parameters passed into this method are used.
public LoadSettings ( string $settingsIniPath, string $defaultVersion, string $defaultServer, string $defaultLogsDir, string $logsRelativePathBase )
$settingsIniPath string the path to the settings INI file
$defaultVersion string the default version if the settings INI file cannot be loaded
$defaultServer string the default server if the settings INI file cannot be loaded
$defaultLogsDir string the default logs directory if the settings INI file cannot be loaded
$logsRelativePathBase string the relative path base for the logs directory

LogAll() public méthode

Configures the library to log all requests.
public LogAll ( )

LogDefaults() public méthode

Configures the library to log basic information about all requests and the full SOAP XML request and response only when an error occurs.
public LogDefaults ( )

LogErrors() public méthode

Configures the library to only log requests that return an error.
public LogErrors ( )

SetDefaultServer() public méthode

Sets the default server.
public SetDefaultServer ( string $defaultServer )
$defaultServer string the default server

SetDefaultVersion() public méthode

Sets the default version.
public SetDefaultVersion ( string $defaultVersion )
$defaultVersion string the default version

SetHeaderValue() public méthode

Sets the value for a request header.
public SetHeaderValue ( string $key, string $value )
$key string the name of the request header element
$value string the value for the request header element

SetOAuth2Handler() public méthode

Sets the OAuth2 handler for this user.
public SetOAuth2Handler ( array $oauth2Handler )
$oauth2Handler array the OAuth2 handler for this user

SetOAuth2Info() public méthode

Sets the OAuth2 info for this user.
public SetOAuth2Info ( array $oauth2Info )
$oauth2Info array the OAuth2 info for this user

ValidateOAuth2Info() protected méthode

Validates that the OAuth2 info is complete.
protected ValidateOAuth2Info ( )

__construct() protected méthode

Constructor for AdsUser.
protected __construct ( )

getIsIncludeUtilitiesInUserAgent() public méthode

public getIsIncludeUtilitiesInUserAgent ( ) : boolean
Résultat boolean whether or not names of ads utilities being used will be included in the user agent

setIncludeUtilitiesInUserAgent() public méthode

public setIncludeUtilitiesInUserAgent ( boolean $isIncludeUtilitiesInUserAgent )
$isIncludeUtilitiesInUserAgent boolean whether ads utilities being used will be included in the user agent

updateClientLibraryUserAgent() public méthode

TODO(vtsao): The current contract requires that subclasses call this method in their constructor.
public updateClientLibraryUserAgent ( string $applicationName )
$applicationName string The application name that will appear in this header