[PSR] Fixed library source

- Using `php-cs-fixer` tool.
This commit is contained in:
Jay Patel
2016-07-14 13:06:24 -05:00
parent a46855bfef
commit 1401d5563d
24 changed files with 41 additions and 55 deletions

View File

@@ -20,7 +20,9 @@ abstract class AuthorizationCache
public static function pull($config = null, $clientId = null)
{
// Return if not enabled
if (!self::isEnabled($config)) { return null; }
if (!self::isEnabled($config)) {
return null;
}
$tokens = null;
$cachePath = self::cachePath($config);
@@ -54,7 +56,9 @@ abstract class AuthorizationCache
public static function push($config = null, $clientId, $accessToken, $tokenCreateTime, $tokenExpiresIn)
{
// Return if not enabled
if (!self::isEnabled($config)) { return; }
if (!self::isEnabled($config)) {
return;
}
$cachePath = self::cachePath($config);
if (!is_dir(dirname($cachePath))) {
@@ -116,6 +120,4 @@ abstract class AuthorizationCache
$config = ($config && is_array($config)) ? $config : PayPalConfigManager::getInstance()->getConfigHashmap();
return (array_key_exists($key, $config)) ? trim($config[$key]) : null;
}
}

View File

@@ -1,6 +1,7 @@
<?php
namespace PayPal\Common;
use PayPal\Validation\JsonValidator;
use PayPal\Validation\ModelAccessorValidator;
@@ -67,7 +68,9 @@ class PayPalModel
public static function getList($data)
{
// Return Null if Null
if ($data === null) { return null; }
if ($data === null) {
return null;
}
if (is_a($data, get_class(new \stdClass()))) {
//This means, root element is object

View File

@@ -21,7 +21,6 @@ class PayPalUserAgent
*/
public static function getValue($sdkName, $sdkVersion)
{
$featureList = array(
'platform-ver=' . PHP_VERSION,
'bit=' . self::_getPHPBit(),

View File

@@ -1,6 +1,7 @@
<?php
namespace PayPal\Common;
use PayPal\Exception\PayPalConfigurationException;
/**
@@ -120,7 +121,7 @@ class ReflectionUtil
return null;
}
foreach ($annots[1] as $i => $annot) {
$annotations[strtolower($annot)] = empty($annots[2][$i]) ? TRUE : rtrim($annots[2][$i], " \t\n\r)");
$annotations[strtolower($annot)] = empty($annots[2][$i]) ? true : rtrim($annots[2][$i], " \t\n\r)");
}
return $annotations;

View File

@@ -95,7 +95,6 @@ class PayPalConfigManager
*/
public function get($searchKey)
{
if (array_key_exists($searchKey, $this->configs)) {
return $this->configs[$searchKey];
} else {
@@ -108,7 +107,6 @@ class PayPalConfigManager
return $arr;
}
}
/**
@@ -123,7 +121,6 @@ class PayPalConfigManager
*/
public function getIniPrefix($userId = null)
{
if ($userId == null) {
$arr = array();
foreach ($this->configs as $key => $value) {
@@ -157,7 +154,4 @@ class PayPalConfigManager
{
trigger_error('Clone is not allowed.', E_USER_ERROR);
}
}

View File

@@ -113,7 +113,6 @@ class PayPalCredentialManager
$suffix++;
$key = $prefix . $suffix;
}
}
/**
@@ -164,5 +163,4 @@ class PayPalCredentialManager
{
trigger_error('Clone is not allowed.', E_USER_ERROR);
}
}

View File

@@ -21,7 +21,7 @@ class PayPalHttpConfig
public static $defaultCurlOptions = array(
CURLOPT_SSLVERSION => 6,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60, // maximum number of seconds to allow cURL functions to execute
CURLOPT_USERAGENT => 'PayPal-PHP-SDK',
CURLOPT_HTTPHEADER => array(),

View File

@@ -55,7 +55,6 @@ class PayPalHttpConnection
*/
private function getHttpHeaders()
{
$ret = array();
foreach ($this->httpConfig->getHeaders() as $k => $v) {
$ret[] = "$k: $v";
@@ -101,7 +100,7 @@ class PayPalHttpConnection
}
//Default Option if Method not of given types in switch case
if ($this->httpConfig->getMethod() != NULL) {
if ($this->httpConfig->getMethod() != null) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpConfig->getMethod());
}
@@ -191,5 +190,4 @@ class PayPalHttpConnection
//Return result object
return $result;
}
}

View File

@@ -116,5 +116,4 @@ class PayPalLoggingManager
$this->logger->debug($message);
}
}
}

View File

@@ -32,5 +32,4 @@ class PayPalInvalidCredentialException extends \Exception
. ': <b>' . $this->getMessage() . '</b>';
return $errorMsg;
}
}

View File

@@ -33,5 +33,4 @@ class PayPalMissingCredentialException extends \Exception
return $errorMsg;
}
}

View File

@@ -47,7 +47,6 @@ class RestHandler implements IPayPalHandler
*/
public function handle($httpConfig, $request, $options)
{
$credential = $this->apiContext->getCredential();
$config = $this->apiContext->getConfig();

View File

@@ -13,5 +13,4 @@ interface PayPalLogFactory
* @return LoggerInterface instance of logger object implementing LoggerInterface
*/
public function getLogger($className);
}

View File

@@ -6,7 +6,6 @@ use PayPal\Core\PayPalConfigManager;
use Psr\Log\AbstractLogger;
use Psr\Log\LogLevel;
class PayPalLogger extends AbstractLogger
{

View File

@@ -18,7 +18,7 @@ class Cipher
*/
const IV_SIZE = 16;
function __construct($secretKey)
public function __construct($secretKey)
{
$this->secretKey = $secretKey;
}
@@ -29,7 +29,7 @@ class Cipher
* @param $input
* @return string
*/
function encrypt($input)
public function encrypt($input)
{
// Create a random IV. Not using mcrypt to generate one, as to not have a dependency on it.
$iv = substr(uniqid("", true), 0, Cipher::IV_SIZE);
@@ -45,7 +45,7 @@ class Cipher
* @param $input
* @return string
*/
function decrypt($input)
public function decrypt($input)
{
// Decode the IV + data
$input = base64_decode($input);

View File

@@ -52,7 +52,6 @@ class PayPalRestCall
*/
public function execute($handlers = array(), $path, $method, $data = '', $headers = array())
{
$config = $this->apiContext->getConfig();
$httpConfig = new PayPalHttpConfig(null, $method, $config);
$headers = $headers ? $headers : array();
@@ -75,5 +74,4 @@ class PayPalRestCall
return $response;
}
}

View File

@@ -21,7 +21,6 @@ class NumericValidator
{
if (trim($argument) != null && !is_numeric($argument)) {
throw new \InvalidArgumentException("$argumentName is not a valid numeric value");
}
return true;
}