__construct() public method

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

  1. Using an authenitcation 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 | null $authenticationIniPath = null, string | null $developerToken = null, string | null $userAgent = null, string | null $clientCustomerId = null, string | null $settingsIniPath = null, array | null $oauth2Info = null )
$authenticationIniPath string | null 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
$developerToken string | null the developer token (required header). Will overwrite the developer token entry loaded from any INI file
$userAgent string | null the user agent name (required header). Will be prepended with the library name and version. Will overwrite the userAgent entry loaded from any INI file
$clientCustomerId string | null the client customer ID to make the request against (optional header). Will overwrite the clientCustomerId entry loaded from any INI file
$settingsIniPath string | null the path to the settings INI file. If null, the default settings INI file will be loaded
$oauth2Info array | null the OAuth 2.0 information to use for requests
Example #1
0
 /**
  * Class constructor
  * 
  * @param1 - auth data. Can be array with auth info, 
  *    xml-type content, filename of auth xml or ini file
  * @param2 - settings data. Can be array with settings info,
  *    xml-type content, filename of settings ini or xml file.       
  *         
  */
 public function __construct($auth = NULL, $settings = NULL)
 {
     $this->defaultLogsDir = dirname(__FILE__);
     $this->logsRelativePathBase = dirname(__FILE__);
     // parent constructor not needed
     //    AdsUser::__construct();
     //      parent::__construct($auth,null,null,null,null,null,null,$settings);
     if (isset($auth) && $auth) {
         $this->CheckAuth($auth);
     }
     if (isset($settings) && $settings) {
         $this->CheckSettings($settings);
     }
     parent::__construct($auth, null, null, null, null, null, null, $settings);
     $oAuth2Handler = $this->GetOAuth2Handler();
     if (!isset($oAuth2Handler) || empty($oAuth2Handler) || !is_object($oAuth2Handler)) {
         //@todo send server, scope and curlUtils to constructor?
         $oAuth2Handler = new OAuth2HandlerExt();
         $this->SetOAuth2Handler($oAuth2Handler);
     }
 }