[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);
@@ -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;
}
}