$clientId, 'accessToken' => $accessToken, 'tokenCreateTime' => $tokenCreateTime, 'tokenExpiresIn' => $tokenExpiresIn ); } file_put_contents($cachePath, json_encode($tokens)); } /** * Determines from the Configuration if caching is currently enabled/disabled * * @param $config * @return bool */ public static function isEnabled($config) { $config = ($config && is_array($config)) ? $config : PayPalConfigManager::getInstance()->getConfigHashmap(); if (array_key_exists("cache.enabled", $config)) { $value = $config['cache.enabled']; return (trim($value) == true || trim($value) == 'true') ? true : false; } return false; } /** * Returns the cache file path * * @param $config * @return string */ public static function cachePath($config) { $config = ($config && is_array($config)) ? $config : PPConfigManager::getInstance()->getConfigHashmap(); $cachePath = (array_key_exists("cache.FileName", $config)) ? trim($config['cache.FileName']) : null; return empty($cachePath) ? __DIR__ . self::$CACHE_PATH : $cachePath; } }