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__));
}