本文整理汇总了PHP中static::driver方法的典型用法代码示例。如果您正苦于以下问题:PHP static::driver方法的具体用法?PHP static::driver怎么用?PHP static::driver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::driver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFileSystem
/**
* 获取Filesystem
* @return Filesystem
*/
public static function getFileSystem()
{
if (is_null(static::$driver)) {
static::$driver = \Storage::drive('local');
}
return static::$driver;
}
示例2: setDriver
public static function setDriver($new_driver)
{
$c = 'AeriaCache' . $new_driver;
if (class_exists($c)) {
static::$driver = $c;
}
}
示例3: factory
/**
* Factory method.
*
* @static
* @access public
* @since 1.0.0-alpha
* @version 1.0.0-alpha
*/
public static function factory()
{
self::$defaultLifeTime = Config::get('cache.lifetime', 3600);
$driverName = ucfirst(Config::get('cache.driver'));
$driver = '\\Plethora\\Cache\\Drivers\\' . $driverName . 'CacheDriver';
static::$driver = new $driver();
Log::insert('Cache type "' . Config::get('cache.driver') . '" initialized!');
}
示例4: init
public static function init($driver = null)
{
if ($driver == null) {
static::$driver = new DiskFileSystemDriver();
} elseif ($driver instanceof LocalStorageDriverInterface) {
static::$driver = $driver;
} else {
throw new Exception('driver must be instance of LocalStorageDriverInterface');
}
}
示例5: tearDownAfterClass
public static function tearDownAfterClass()
{
static::$driver = null;
static::$pdo = null;
foreach (static::$tempFiles as $file) {
if (is_file($file)) {
unlink($file);
}
}
parent::tearDownAfterClass();
}
示例6: __construct
/**
* Constructor.
*
* @access protected
*/
protected function __construct()
{
// Set current time
static::$now = time();
// Cache key allows us to invalidate all cache on configuration changes.
static::$key = (Config::get('system.cache.prefix') ? Config::get('system.cache.prefix') : 'fansoro') . '-' . md5(ROOT_DIR . Fansoro::VERSION);
// Get Cache Driver
static::$driver = static::getCacheDriver();
// Set the cache namespace to our unique key
static::$driver->setNamespace(static::$key);
}
示例7: using
public static function using($driver, $options = null)
{
$class = 'Email\\' . ucfirst(strtolower($driver));
if (!class_exists($class)) {
throw new Exception("[core.email] : {$driver} driver not found.");
}
static::$driver_name = $driver;
static::$options = $options;
static::$driver = new $class();
static::$driver->onInit($options);
}
示例8: __construct
/**
* Create new session.
*
* @return void
*/
public function __construct()
{
// Does the session need to be initialized?
if (!static::$initialized) {
// Get the driver name from the application config and get the
// class name for us to instantiate.
$driver = 'native';
$class = 'Spire\\Session\\Driver\\' . ucfirst(strtolower($driver));
// Instantiate driver.
static::$driver = new $class();
// Initialize the session.
if (static::driver()->initialize()) {
static::$initialized = true;
}
}
}
示例9: init
/**
* Initialize both database and forge components
*/
public static function init($driver)
{
if (empty(static::$db) && empty(static::$forge)) {
$config = Mock_Database_DB::config($driver);
$connection = new Mock_Database_DB($config);
$db = Mock_Database_DB::DB($connection->set_dsn($driver), TRUE);
CI_TestCase::instance()->ci_instance_var('db', $db);
$loader = new CI_Loader();
$loader->dbforge();
$forge = CI_TestCase::instance()->ci_instance_var('dbforge');
static::$db = $db;
static::$forge = $forge;
static::$driver = $driver;
}
return static::$db;
}
示例10: _init
/**
* Init, config loading.
* @throws Amon_Request_Exception
*/
public static function _init()
{
\Config::load('amon', true);
static::$config = \Config::get('amon');
if (!class_exists('\\ZMQContext')) {
static::$config['protocol'] = 'http';
}
$class = 'Amon_Request_' . ucwords(strtolower(static::$config['protocol']));
if (!class_exists($class)) {
throw new Amon_Request_Exception('Can not find request driver');
}
try {
static::$driver = new $class(static::$config['host'], static::$config['port'], static::$config['application_key']);
} catch (Amon_Request_Exception $e) {
throw $e;
}
}
示例11: using
/**
* Load cache drivers with a FCFS strategy
*
* @method using
* @param mixed $driver can be a single driver name string, an array of driver names or a map [ driver_name => driver_options array ]
* @return bool true if a driver was loaded
* @example
*
* Cache::using('redis');
* Cache::using(['redis','files','memory']); // Prefer "redis" over "files" over "memory" caching
* Cache::using([
* 'redis' => [
* 'host' => '127.0.0.1',
* 'prefix' => 'mycache',
* ],
* 'files' => [
* 'cache_dir' => '/tmp',
* ],
* 'memory'
* ]);
*
*/
public static function using($driver)
{
foreach ((array) $driver as $key => $value) {
if (is_numeric($key)) {
$drv = $value;
$conf = [];
} else {
$drv = $key;
$conf = $value;
}
$class = 'Cache\\' . ucfirst(strtolower($drv));
if (class_exists($class) && $class::valid()) {
static::$driver = new $class($conf);
return true;
}
}
return false;
}
示例12: driver
/**
* Get the session driver.
*
* @return Session\Driver
*/
public static function driver()
{
if (is_null(static::$driver)) {
switch (Config::get('session.driver')) {
case 'cookie':
return static::$driver = new Session\Cookie();
case 'file':
return static::$driver = new Session\File();
case 'db':
return static::$driver = new Session\DB();
case 'memcached':
return static::$driver = new Session\Memcached();
case 'apc':
return static::$driver = new Session\APC();
default:
throw new \Exception("Session driver [{$driver}] is not supported.");
}
}
return static::$driver;
}
示例13: setDriver
/**
* Sets the database driver (string).
*/
public static function setDriver($driver)
{
static::$driver = strtolower($driver);
}
示例14: setDriver
/**
* @param ILogStore $d driver to be set
*/
public static function setDriver(ILogStore $d)
{
static::$driver = $d;
}
示例15: _init
public static function _init()
{
static::$driver = new \G2verify_Driver();
}