Removing Dependency from SDK Core Project

- Copied files required for Rest API SDK
- Removed PPApiContext and directly connected APIContext with PPConfigManager
- Removed duplicate data storage of configuration and credentials.
- Code Style Fixes
- Remove build.xml file as it is not required anymore
- Updated the samples
- Updated the documentations
This commit is contained in:
japatel
2014-10-06 11:16:47 -05:00
parent bb7654b0b8
commit 49b80f76af
150 changed files with 10975 additions and 6525 deletions

View File

@@ -0,0 +1,59 @@
<?php
namespace PayPal\Common;
/**
* Class PPUserAgent
* PPUserAgent generates User Agent for curl requests
*
* @package PayPal\Common
*/
class PPUserAgent
{
/**
* Returns the value of the User-Agent header
* Add environment values and php version numbers
*
* @param string $sdkName
* @param string $sdkVersion
* @return string
*/
public static function getValue($sdkName, $sdkVersion)
{
$featureList = array(
'lang=PHP',
'v=' . PHP_VERSION,
'bit=' . self::_getPHPBit(),
'os=' . str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')),
'machine=' . php_uname('m')
);
if (defined('OPENSSL_VERSION_TEXT')) {
$opensslVersion = explode(' ', OPENSSL_VERSION_TEXT);
$featureList[] = 'openssl=' . $opensslVersion[1];
}
if (function_exists('curl_version')) {
$curlVersion = curl_version();
$featureList[] = 'curl=' . $curlVersion['version'];
}
return sprintf("PayPalSDK/%s %s (%s)", $sdkName, $sdkVersion, implode(';', $featureList));
}
/**
* Gets PHP Bit version
*
* @return int|string
*/
private static function _getPHPBit()
{
switch (PHP_INT_SIZE) {
case 4:
return '32';
case 8:
return '64';
default:
return PHP_INT_SIZE;
}
}
}