PHP Класс AdsUser, googleads-php-lib

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

GetAuthVarValue() защищенный Метод

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
Результат string the authentication variable value

GetClientLibraryNameAndVersion() абстрактный защищенный Метод

Gets the name and version of this client library.
abstract protected GetClientLibraryNameAndVersion ( ) : array
Результат array An array containing the name and version of this client library, e.g.: ['DfpApi-PHP', '2.13.0'].

GetClientLibraryUserAgent() публичный Метод

Gets the user agent string that identifies this library for this user.
public GetClientLibraryUserAgent ( ) : string
Результат string A user agent string.

GetDefaultOAuth2Handler() абстрактный публичный Метод

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
Результат mixed the configured OAuth2Handler class

GetDefaultServer() публичный Метод

Gets the default server.
public GetDefaultServer ( ) : string
Результат string the default server

GetDefaultVersion() публичный Метод

Gets the default version.
public GetDefaultVersion ( ) : string
Результат string the default version

GetForceAddXsiTypes() публичный Метод

Gets the setting of whether or not to add XSI types in the SOAP payload.
public GetForceAddXsiTypes ( ) : boolean
Результат boolean whether or not to add XSI types in the SOAP payload

GetForceHttpVersion() публичный Метод

Gets the version of the HTTP protocol to use regardless of PHP version.
public GetForceHttpVersion ( ) : float
Результат float the HTTP version that should be used

GetHeaderNames() публичный Метод

Gets the names of all registered request header elements.
public GetHeaderNames ( ) : array
Результат array the names of the request header elements

GetHeaderValue() публичный Метод

Gets the value for a registered request header element.
public GetHeaderValue ( string $key ) : string
$key string the name of the request header element
Результат string the value of the request header element or null if not found

GetLogsDirectory() публичный Метод

Gets the logs directory.
public GetLogsDirectory ( ) : string
Результат string the logs directory

GetOAuth2Handler() публичный Метод

Gets the OAuth2 handler for this user.
public GetOAuth2Handler ( ) : OAuth2Handler
Результат OAuth2Handler the OAuth2 handler for this user

GetOAuth2Info() публичный Метод

Gets the OAuth2 info for this user.
public GetOAuth2Info ( ) : array
Результат array the OAuth2 info for this user

GetServiceSoapClient() публичный Метод

Gets the service by its service name.
public GetServiceSoapClient ( string $serviceName, SoapClientFactory $serviceFactory ) : SoapClient
$serviceName string the service name
$serviceFactory SoapClientFactory the service factory
Результат SoapClient the instantiated service

GetSoapCompressionLevel() публичный Метод

Gets the SOAP compression level.
public GetSoapCompressionLevel ( ) : integer
Результат integer the SOAP compression level

GetUserAgentHeaderName() абстрактный защищенный Метод

Gets the appropriate user agent header name for the API this client library is targeting.
abstract protected GetUserAgentHeaderName ( ) : string
Результат string The user agent header name.

GetWsdlCacheType() публичный Метод

Gets the type of WSDL caching in use.
public GetWsdlCacheType ( ) : integer
Результат integer the type of WSDL caching in use

InitLogs() защищенный Метод

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() публичный Метод

Is SOAP compression enabled.
public IsSoapCompressionEnabled ( ) : boolean
Результат boolean is SOAP compression enabled

LoadSettings() публичный Метод

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() публичный Метод

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

LogDefaults() публичный Метод

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() публичный Метод

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

SetDefaultServer() публичный Метод

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

SetDefaultVersion() публичный Метод

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

SetHeaderValue() публичный Метод

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() публичный Метод

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

SetOAuth2Info() публичный Метод

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

ValidateOAuth2Info() защищенный Метод

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

__construct() защищенный Метод

Constructor for AdsUser.
protected __construct ( )

getIsIncludeUtilitiesInUserAgent() публичный Метод

public getIsIncludeUtilitiesInUserAgent ( ) : boolean
Результат boolean whether or not names of ads utilities being used will be included in the user agent

setIncludeUtilitiesInUserAgent() публичный Метод

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

updateClientLibraryUserAgent() публичный Метод

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