forked from LiveCarta/PayPal-PHP-SDK
[PSR] Fixed library source
- Using `php-cs-fixer` tool.
This commit is contained in:
@@ -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);
|
||||
@@ -32,7 +34,7 @@ abstract class AuthorizationCache
|
||||
if ($clientId && is_array($tokens) && array_key_exists($clientId, $tokens)) {
|
||||
// If client Id is found, just send in that data only
|
||||
return $tokens[$clientId];
|
||||
} else if ($clientId) {
|
||||
} elseif ($clientId) {
|
||||
// If client Id is provided, but no key in persisted data found matching it.
|
||||
return null;
|
||||
}
|
||||
@@ -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))) {
|
||||
@@ -74,7 +78,7 @@ abstract class AuthorizationCache
|
||||
'tokenExpiresIn' => $tokenExpiresIn
|
||||
);
|
||||
}
|
||||
if(!file_put_contents($cachePath, json_encode($tokens))) {
|
||||
if (!file_put_contents($cachePath, json_encode($tokens))) {
|
||||
throw new \Exception("Failed to write cache");
|
||||
};
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user