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

Constructor for AdsUser.
protected __construct ( )
Пример #1
0
 public function __construct($authenticationIniPath = null, $applicationName = null, $networkCode = null, $settingsIniPath = null, $oauth2Info = null)
 {
     parent::__construct();
     $config = $this->getConfig();
     $this->libName = $config['Dfp']['build']['LIB_NAME'];
     $this->libVersion = $config['common']['build']['LIB_VERSION'];
     $apiProps = ApiPropertiesUtils::ParseApiPropertiesFile(dirname(__FILE__) . '/api.properties');
     $versions = explode(',', $apiProps['api.versions']);
     $defaultVersion = $versions[count($versions) - 1];
     $defaultServer = $apiProps['api.server'];
     if ($authenticationIniPath === null) {
         $authenticationIniPath = dirname(__FILE__) . '/../auth.ini';
     }
     $authenticationIni = parse_ini_file(realpath($authenticationIniPath), true);
     $applicationName = $this->GetAuthVarValue($applicationName, self::USER_AGENT_HEADER_NAME, $authenticationIni);
     $networkCode = $this->GetAuthVarValue($networkCode, 'networkCode', $authenticationIni);
     $oauth2Info = $this->GetAuthVarValue($oauth2Info, 'OAUTH2', $authenticationIni);
     if (isset($oauth2Info['oAuth2AdditionalScopes'])) {
         $scopes = explode(',', $oauth2Info['oAuth2AdditionalScopes']);
     } else {
         $scopes = array();
     }
     $scopes[] = self::OAUTH2_SCOPE;
     $this->SetOAuth2Info($oauth2Info);
     $this->SetApplicationName($applicationName);
     $this->SetClientLibraryUserAgent($applicationName);
     $this->SetNetworkCode($networkCode);
     $this->SetScopes($scopes);
     if ($settingsIniPath === null) {
         $settingsIniPath = dirname(__FILE__) . '/../settings.ini';
     }
     $this->loadSettings($settingsIniPath, $defaultVersion, $defaultServer, getcwd(), dirname(__FILE__));
 }
 public function __construct()
 {
     parent::__construct();
     $this->requestHeaderElements = [];
     $config = $this->getConfig();
     $this->libVersion = $config['common']['build']['LIB_VERSION'];
     $this->libName = $config['common']['build']['LIB_NAME'];
 }
Пример #3
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();
     if (isset($auth) && $auth) {
         $this->CheckAuth($auth);
     }
     if (isset($settings) && $settings) {
         $this->CheckSettings($settings);
     }
 }
 /**
  * The AdWordsUser constructor.
  * <p>The AdWordsUser class can be configured in one of two ways:
  * <ol><li>Using an authenitcation INI file</li>
  * <li>Using supplied credentials</li></ol></p>
  * <p>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 <var>null</var>)
  * 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 <var>null</var>, will, however, overwrite any
  * parameter loaded from the default INI.</p>
  * <p>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.</p>
  * @param string $authenticationIniPath the absolute path to the
  *     authentication INI or relative to the current directory (cwd). If
  *     <var>null</var>, the default authentication INI file will attempt to be
  *     loaded
  * @param string $developerToken the developer token (required header). Will
  *     overwrite the developer token entry loaded from any INI file
  * @param string $userAgent 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
  * @param string $clientCustomerId the client customer ID to make the request
  *     against (optional header). Will overwrite the clientCustomerId entry
  *     loaded from any INI file
  * @param string $settingsIniPath the path to the settings INI file. If
  *     <var>null</var>, the default settings INI file will be loaded
  * @param array $oauth2Info the OAuth 2.0 information to use for requests
  */
 public function __construct($authenticationIniPath = null, $developerToken = null, $userAgent = null, $clientCustomerId = null, $settingsIniPath = null, $oauth2Info = null)
 {
     parent::__construct();
     $buildIniAw = parse_ini_file(dirname(__FILE__) . '/build.ini', false);
     $buildIniCommon = parse_ini_file(dirname(__FILE__) . '/../../Common/Lib/build.ini', false);
     $this->libName = $buildIniAw['LIB_NAME'];
     $this->libVersion = $buildIniCommon['LIB_VERSION'];
     $apiProps = ApiPropertiesUtils::ParseApiPropertiesFile(dirname(__FILE__) . '/api.properties');
     $versions = explode(',', $apiProps['api.versions']);
     $defaultVersion = $versions[count($versions) - 1];
     $defaultServer = $apiProps['api.server'];
     if ($authenticationIniPath === null) {
         $authenticationIniPath = dirname(__FILE__) . '/../auth.ini';
     }
     $authenticationIni = parse_ini_file(realpath($authenticationIniPath), true);
     $developerToken = $this->GetAuthVarValue($developerToken, 'developerToken', $authenticationIni);
     $userAgent = $this->GetAuthVarValue($userAgent, self::USER_AGENT_HEADER_NAME, $authenticationIni);
     $clientCustomerId = $this->GetAuthVarValue($clientCustomerId, 'clientCustomerId', $authenticationIni);
     $oauth2Info = $this->GetAuthVarValue($oauth2Info, 'OAUTH2', $authenticationIni);
     $clientId = $this->GetAuthVarValue(null, 'clientId', $authenticationIni);
     if ($clientId !== null) {
         throw new ValidationException('clientId', $clientId, 'The authentication key "clientId" has been changed to' . ' "clientCustomerId", please use that instead.');
     }
     $this->SetOAuth2Info($oauth2Info);
     $this->SetUserAgent($userAgent);
     $this->SetClientLibraryUserAgent($userAgent);
     $this->SetClientCustomerId($clientCustomerId);
     $this->SetDeveloperToken($developerToken);
     if ($settingsIniPath === null) {
         $settingsIniPath = dirname(__FILE__) . '/../settings.ini';
     }
     $this->LoadSettings($settingsIniPath, $defaultVersion, $defaultServer, getcwd(), dirname(__FILE__));
 }
Пример #5
0
 /**
  * The YDirectUser constructor.
  * <p>The YDirectUser class can be configured in one of two ways:
  * <ol><li>Using an authenitcation INI file</li>
  * <li>Using supplied credentials</li></ol></p>
  * <p>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 <var>NULL</var>)
  * 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 <var>NULL</var>, will, however, overwrite any
  * parameter loaded from the default INI.</p>
  * <p>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.</p>
  * @param string $authenticationIniPath the absolute path to the
  *     authentication INI or relative to the current directory (cwd). If
  *     <var>NULL</var>, the default authentication INI file will attempt to be
  *     loaded
  * @param string $email the email of the user (required header). Will
  *     overwrite the email entry loaded from any INI file
  * @param string $password the password of the user (required header). Will
  *     overwrite the password entry loaded from any INI file
  * @param string $developerToken the developer token (required header). Will
  *     overwrite the developer token entry loaded from any INI file
  * @param string $applicationToken the application token (required header).
  *     Will overwrite the application token entry loaded from any INI file
  * @param string $userAgent the user agent name (required header). Will
  *     be prepended with the library name and version. Will also overwrite the
  *     userAgent entry in any INI file
  * @param string $clientId the client email or ID to make the request against
  *     (optional header). Will overwrite the clientId, clientEmail, or
  *     clientCustomerId entries loaded from any INI file
  * @param string $settingsIniPath the path to the settings INI file. If
  *     <var>NULL</var>, the default settings INI file will be loaded
  * @param string $authToken the authToken to use for requests
  * @param array $oauthInfo the OAuth information to use for requests
  */
 public function __construct($authenticationIniPath = NULL, $login = NULL, $email = NULL, $password = NULL, $developerToken = NULL, $applicationToken = NULL, $userAgent = NULL, $clientId = NULL, $settingsIniPath = NULL, $authToken = NULL, $oauthInfo = NULL)
 {
     parent::__construct();
     $this->libVersion = YDirectUser::$LIB_VERSION;
     $this->libName = YDirectUser::$LIB_NAME;
     $this->defaultVersion = YDirectUser::$DEFAULT_VERSION;
     $this->defaultServer = YDirectUser::$DEFAULT_SERVER;
     if (isset($authenticationIniPath)) {
         $authenticationIni = parse_ini_file(realpath($authenticationIniPath), TRUE);
     } else {
         $authenticationIni = parse_ini_file(dirname(__FILE__) . '/../auth.ini', TRUE);
     }
     $login = $this->GetAuthVarValue($login, 'login', $authenticationIni);
     $email = $this->GetAuthVarValue($email, 'email', $authenticationIni);
     $oauthInfo = $this->GetAuthVarValue($oauthInfo, 'OAUTH', $authenticationIni);
     $this->SetLogin($login);
     $this->SetEmail($email);
     $this->SetOAuth2Info($oauthInfo);
     if (!isset($settingsIniPath)) {
         $settingsIniPath = dirname(__FILE__) . '/../settings.ini';
     }
     $this->LoadSettings($settingsIniPath, $this->defaultVersion, $this->defaultServer, dirname(__FILE__), dirname(__FILE__));
 }
Пример #6
0
 /**
  * The DfpUser constructor.
  * <p>The DfpUser class can be configured in one of two ways:
  * <ol>
  * <li>Using an authenitcation INI file</li>
  * <li>Using supplied credentials</li>
  * </ol></p>
  * <p>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 <var>NULL</var>)
  * 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 <var>NULL</var> will however, overwrite any
  * parameter loaded from the default INI.</p>
  * <p>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.</p>
  * @param string $authenticationIniPath the absolute path to the
  *     authentication INI or relative to the current directory (cwd). If
  *     <var>NULL</var>, the default authentication INI file will attempt to be
  *     loaded
  * @param string $email the email of the user (required header). Will
  *     overwrite the email entry loaded from any INI file
  * @param string $password the password of the user (required header). Will
  *     overwrite the password entry loaded from any INI file
  * @param string $applicationName the application name (required header). Will
  *     be prepended with the library name and version. Will also overwrite the
  *     applicationName entry in any INI file
  * @param string $networkCode the network code the user belongs to
  *     (optional header). Can be left <var>NULL</var> if the user only belongs
  *     to one network. Will overwrite the networkCode entry in any INI
  *     file
  * @param string $settingsIniPath the path to the settings INI file. If
  *     <var>NULL</var>, the default settings INI file will be loaded
  * @param string $authToken the authToken to use for requests
  * @param array $oauthInfo the OAuth information to use for requests
  */
 public function __construct($authenticationIniPath = NULL, $email = NULL, $password = NULL, $applicationName = NULL, $networkCode = NULL, $settingsIniPath = NULL, $authToken = NULL, $oauthInfo = NULL, $oauth2Info = NULL)
 {
     parent::__construct();
     if (isset($authenticationIniPath)) {
         $authenticationIni = parse_ini_file(realpath($authenticationIniPath), TRUE);
     } else {
         $authenticationIni = parse_ini_file(dirname(__FILE__) . '/../auth.ini', TRUE);
     }
     $email = $this->GetAuthVarValue($email, 'email', $authenticationIni);
     $password = $this->GetAuthVarValue($password, 'password', $authenticationIni);
     $applicationName = $this->GetAuthVarValue($applicationName, self::USER_AGENT_HEADER_NAME, $authenticationIni);
     $networkCode = $this->GetAuthVarValue($networkCode, 'networkCode', $authenticationIni);
     $authToken = $this->GetAuthVarValue($authToken, 'authToken', $authenticationIni);
     $oauthInfo = $this->GetAuthVarValue($oauthInfo, 'OAUTH', $authenticationIni);
     $oauth2Info = $this->GetAuthVarValue($oauth2Info, 'OAUTH2', $authenticationIni);
     $this->SetEmail($email);
     $this->SetPassword($password);
     $this->SetAuthToken($authToken);
     $this->SetOAuthInfo($oauthInfo);
     $this->SetOAuth2Info($oauth2Info);
     $this->SetApplicationName($applicationName);
     $this->SetClientLibraryUserAgent($applicationName);
     $this->SetNetworkCode($networkCode);
     if (!isset($settingsIniPath)) {
         $settingsIniPath = dirname(__FILE__) . '/../settings.ini';
     }
     $this->loadSettings($settingsIniPath, self::DEFAULT_VERSION, self::DEFAULT_SERVER, dirname(__FILE__), dirname(__FILE__));
 }
Пример #7
0
 /**
  * The DfpUser constructor.
  * <p>The DfpUser class can be configured in one of two ways:
  * <ol>
  * <li>Using an authentication INI file</li>
  * <li>Using supplied credentials</li>
  * </ol></p>
  * <p>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 <var>NULL</var>)
  * 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 <var>NULL</var> will however, overwrite any
  * parameter loaded from the default INI.</p>
  * <p>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.</p>
  * @param string $authenticationIniPath the absolute path to the
  *     authentication INI or relative to the current directory (cwd). If
  *     <var>NULL</var>, the default authentication INI file will attempt to be
  *     loaded
  * @param string $applicationName the application name (required header). Will
  *     be prepended with the library name and version. Will also overwrite the
  *     applicationName entry in any INI file
  * @param string $networkCode the network code the user belongs to
  *     (optional header). Can be left <var>NULL</var> if the user only belongs
  *     to one network. Will overwrite the networkCode entry in any INI
  *     file
  * @param string $settingsIniPath the path to the settings INI file. If
  *     <var>NULL</var>, the default settings INI file will be loaded
  * @param array $oauth2Info the OAuth 2.0 information to use for requests
  */
 public function __construct($authenticationIniPath = NULL, $applicationName = NULL, $networkCode = NULL, $settingsIniPath = NULL, $oauth2Info = NULL)
 {
     parent::__construct();
     $buildIniDfp = parse_ini_file(dirname(__FILE__) . '/build.ini', false);
     $buildIniCommon = parse_ini_file(dirname(__FILE__) . '/../../Common/Lib/build.ini', false);
     $this->libName = $buildIniDfp['LIB_NAME'];
     $this->libVersion = $buildIniCommon['LIB_VERSION'];
     $apiProps = ApiPropertiesUtils::ParseApiPropertiesFile(dirname(__FILE__) . '/api.properties');
     $versions = explode(',', $apiProps['api.versions']);
     $defaultVersion = $versions[count($versions) - 1];
     $defaultServer = $apiProps['api.server'];
     if (isset($authenticationIniPath)) {
         $authenticationIni = parse_ini_file(realpath($authenticationIniPath), TRUE);
     } else {
         $authenticationIni = parse_ini_file(dirname(__FILE__) . '/../auth.ini', TRUE);
     }
     $applicationName = $this->GetAuthVarValue($applicationName, self::USER_AGENT_HEADER_NAME, $authenticationIni);
     $networkCode = $this->GetAuthVarValue($networkCode, 'networkCode', $authenticationIni);
     $oauth2Info = $this->GetAuthVarValue($oauth2Info, 'OAUTH2', $authenticationIni);
     $this->SetOAuth2Info($oauth2Info);
     $this->SetApplicationName($applicationName);
     $this->SetClientLibraryUserAgent($applicationName);
     $this->SetNetworkCode($networkCode);
     if (!isset($settingsIniPath)) {
         $settingsIniPath = dirname(__FILE__) . '/../settings.ini';
     }
     $this->loadSettings($settingsIniPath, $defaultVersion, $defaultServer, getcwd(), dirname(__FILE__));
 }
 /**
  * Creates a new instance of this test subclass.
  */
 public function __construct()
 {
     parent::__construct();
     $this->SetClientLibraryUserAgent(self::APPLICATION_NAME);
 }
 /**
  * The AdWordsUser constructor.
  * <p>The AdWordsUser class can be configured in one of two ways:
  * <ol><li>Using an authenitcation INI file</li>
  * <li>Using supplied credentials</li></ol></p>
  * <p>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 <var>NULL</var>)
  * 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 <var>NULL</var>, will, however, overwrite any
  * parameter loaded from the default INI.</p>
  * <p>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.</p>
  * @param string $authenticationIniPath the absolute path to the
  *     authentication INI or relative to the current directory (cwd). If
  *     <var>NULL</var>, the default authentication INI file will attempt to be
  *     loaded
  * @param string $email the email of the user (required header). Will
  *     overwrite the email entry loaded from any INI file
  * @param string $password the password of the user (required header). Will
  *     overwrite the password entry loaded from any INI file
  * @param string $developerToken the developer token (required header). Will
  *     overwrite the developer token entry loaded from any INI file
  * @param string $applicationToken the application token (required header).
  *     Will overwrite the application token entry loaded from any INI file
  * @param string $userAgent the user agent name (required header). Will
  *     be prepended with the library name and version. Will also overwrite the
  *     userAgent entry in any INI file
  * @param string $clientId the client email or ID to make the request against
  *     (optional header). Will overwrite the clientId, clientEmail, or
  *     clientCustomerId entries loaded from any INI file
  * @param string $settingsIniPath the path to the settings INI file. If
  *     <var>NULL</var>, the default settings INI file will be loaded
  * @param string $authToken the authToken to use for requests
  * @param array $oauthInfo the OAuth information to use for requests
  */
 public function __construct($authenticationIniPath = NULL, $email = NULL, $password = NULL, $developerToken = NULL, $applicationToken = NULL, $userAgent = NULL, $clientId = NULL, $settingsIniPath = NULL, $authToken = NULL, $oauthInfo = NULL)
 {
     parent::__construct();
     if (isset($authenticationIniPath)) {
         $authenticationIni = parse_ini_file(realpath($authenticationIniPath), TRUE);
     } else {
         $authenticationIni = parse_ini_file(dirname(__FILE__) . '/../auth.ini', TRUE);
     }
     $email = $this->GetAuthVarValue($email, 'email', $authenticationIni);
     $password = $this->GetAuthVarValue($password, 'password', $authenticationIni);
     $developerToken = $this->GetAuthVarValue($developerToken, 'developerToken', $authenticationIni);
     $applicationToken = $this->GetAuthVarValue($applicationToken, 'applicationToken', $authenticationIni);
     $userAgent = $this->GetAuthVarValue($userAgent, 'userAgent', $authenticationIni);
     $clientId = $this->GetAuthVarValue($clientId, 'clientId', $authenticationIni);
     $clientId = $this->GetAuthVarValue($clientId, 'clientEmail', $authenticationIni);
     $clientId = $this->GetAuthVarValue($clientId, 'clientCustomerId', $authenticationIni);
     $authToken = $this->GetAuthVarValue($authToken, 'authToken', $authenticationIni);
     $oauthInfo = $this->GetAuthVarValue($oauthInfo, 'OAUTH', $authenticationIni);
     $this->SetEmail($email);
     $this->SetPassword($password);
     $this->SetAuthToken($authToken);
     $this->SetOAuthInfo($oauthInfo);
     $this->SetClientLibraryUserAgent($userAgent);
     $this->SetClientId($clientId);
     $this->SetDeveloperToken($developerToken);
     $this->SetApplicationToken($applicationToken);
     if (!isset($settingsIniPath)) {
         $settingsIniPath = dirname(__FILE__) . '/../settings.ini';
     }
     $this->LoadSettings($settingsIniPath, AdWordsUser::$DEFAULT_VERSION, AdWordsUser::$DEFAULT_SERVER, dirname(__FILE__), dirname(__FILE__));
 }