<commit_before><?php
namespace phpFastCache;
use phpFastCache\Core\phpFastCache;
use phpFastCache\Core\DriverAbstract;

/**
 * Class CacheManager
 * @author <NAME> (khoaofgod)  <<EMAIL>> http://www.phpfastcache.com
 * @author Georges.L (Geolim4)  <<EMAIL>>
 */
class CacheManager
{
    protected static $instances = array();

    /**
     * @param string $storage
     * @param array $config
     * @return DriverAbstract
     */
    public static function getInstance($storage = 'auto', $config = array())
    {
        $storage = strtolower($storage);
        if (empty($config)) {
            $config = phpFastCache::$config;
        }
        if(isset(phpFastCache::$config['overwrite'])
            && phpFastCache::$config['overwrite'] !== ''
            && phpFastCache::$config['overwrite'] !== 'auto')
        {
            phpFastCache::$config['storage'] = phpFastCache::$config['overwrite'];
            $storage = phpFastCache::$config['overwrite'];
        }
        else if(isset(phpFastCache::$config['storage'])
            && phpFastCache::$config['storage'] !== ''
            && phpFastCache::$config['storage'] !== 'auto')
        {
            $storage = phpFastCache::$config['storage'];
        }
        else if ($storage == '' || $storage == 'auto') {
            $storage = phpFastCache::getAutoClass($config);
        }

        $instance = md5(serialize($config) . $storage);
        if (!isset(self::$instances[ $instance ])) {
            $class = '\phpFastCache\Drivers\\' . $storage;
            self::$instances[ $instance ] = new $class($config);
        }

        return self::$instances[ $instance ];
    }
	/**
	 * CacheManager::Files();
	 * CacheManager::Memcached();
	 */
	public static function __callStatic($name, $arguments)
	{
        if(count($arguments) === 1 && isset($arguments[0])) {
            $arguments = $arguments[0];
        }
        switch(strtolower($name)) {
            case "setup":
                phpFastCache::setup($arguments);
                break;
            default:
                return call_user_func_array(array("self","getInstance"), array($name, $arguments));
                break;
        }
	}

}<commit_msg>Updated CacheManager:<commit_after><?php
namespace phpFastCache;

use phpFastCache\Core\phpFastCache;
use phpFastCache\Core\DriverAbstract;

/**
 * Class CacheManager
 * @author <NAME> (khoaofgod)  <<EMAIL>> http://www.phpfastcache.com
 * @author Georges.L (Geolim4)  <<EMAIL>>
 *
 * @method static DriverAbstract Apc() Apc($config = array()) Return a driver "apc" instance
 * @method static DriverAbstract Cookie() Cookie($config = array()) Return a driver "cookie" instance
 * @method static DriverAbstract Files() Files($config = array()) Return  a driver "files" instance
 * @method static DriverAbstract Memcache() Memcache($config = array()) Return a driver "memcache" instance
 * @method static DriverAbstract Memcached() Memcached($config = array()) Return a driver "memcached" instance
 * @method static DriverAbstract Predis() Predis($config = array()) Return a driver "predis" instance
 * @method static DriverAbstract Redis() Redis($config = array()) Return a driver "redis" instance
 * @method static DriverAbstract Sqlite() Sqlite($config = array()) Return a driver "sqlite" instance
 * @method static DriverAbstract Ssdb() Ssdb($config = array()) Return a driver "ssdb" instance
 * @method static DriverAbstract Wincache() Wincache($config = array()) Return a driver "wincache" instance
 * @method static DriverAbstract Xcache() Xcache($config = array()) Return a driver "xcache" instance
 *
 */
class CacheManager
{
    protected static $instances = array();

    /**
     * @param string $storage
     * @param array $config
     * @return DriverAbstract
     */
    public static function getInstance($storage = 'auto', $config = array())
    {
        $storage = strtolower($storage);
        if (empty($config)) {
            $config = phpFastCache::$config;
        }
        if (isset(phpFastCache::$config[ 'overwrite' ]) && !in_array(phpFastCache::$config[ 'overwrite' ], array('auto', ''), true)) {
            phpFastCache::$config[ 'storage' ] = phpFastCache::$config[ 'overwrite' ];
            $storage = phpFastCache::$config[ 'overwrite' ];
        } else if (isset(phpFastCache::$config[ 'storage' ]) && !in_array(phpFastCache::$config[ 'storage' ], array('auto', ''), true)) {
            $storage = phpFastCache::$config[ 'storage' ];
        } else if (!in_array($storage, array('auto', ''), true)) {
            $storage = phpFastCache::getAutoClass($config);
        }

        $instance = md5(serialize($config) . $storage);
        if (!isset(self::$instances[ $instance ])) {
            $class = '\phpFastCache\Drivers\\' . $storage;
            self::$instances[ $instance ] = new $class($config);
        }

        return self::$instances[ $instance ];
    }

    /**
     * CacheManager::Files();
     * CacheManager::Memcached();
     */
    public static function __callStatic($name, $arguments)
    {
        return self::getInstance($name, (isset($arguments[ 0 ]) ? $arguments[ 0 ] : array()));
    }

    /**
     * Shortcut to phpFastCache::setup()
     */
    public static function setup($name, $value = '')
    {
        phpFastCache::setup($name, $value);
    }
}
{'fraction_non_alphanumeric': 0.1611079706048615, 'fraction_numerical': 0.0016958733747880158, 'mean_word_length': 3.058103975535168, 'pattern_counts': {'":': 1, '<': 15, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5811244', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1493, 'n_words': 345}