Вход Регистрация
Файл: concrete5.7.5.6/concrete/vendor/zendframework/zend-cache/src/Storage/AdapterPluginManager.php
Строк: 92
<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace ZendCacheStorage;

use 
ZendCacheException;
use 
ZendServiceManagerAbstractPluginManager;

/**
 * Plugin manager implementation for cache storage adapters
 *
 * Enforces that adapters retrieved are instances of
 * StorageInterface. Additionally, it registers a number of default
 * adapters available.
 */
class AdapterPluginManager extends AbstractPluginManager
{
    
/**
     * Default set of adapters
     *
     * @var array
     */
    
protected $invokableClasses = array(
        
'apc'            => 'ZendCacheStorageAdapterApc',
        
'dba'            => 'ZendCacheStorageAdapterDba',
        
'filesystem'     => 'ZendCacheStorageAdapterFilesystem',
        
'memcached'      => 'ZendCacheStorageAdapterMemcached',
        
'memory'         => 'ZendCacheStorageAdapterMemory',
        
'redis'          => 'ZendCacheStorageAdapterRedis',
        
'session'        => 'ZendCacheStorageAdapterSession',
        
'xcache'         => 'ZendCacheStorageAdapterXCache',
        
'wincache'       => 'ZendCacheStorageAdapterWinCache',
        
'zendserverdisk' => 'ZendCacheStorageAdapterZendServerDisk',
        
'zendservershm'  => 'ZendCacheStorageAdapterZendServerShm',
    );

    
/**
     * Do not share by default
     *
     * @var array
     */
    
protected $shareByDefault false;

    
/**
     * Validate the plugin
     *
     * Checks that the adapter loaded is an instance of StorageInterface.
     *
     * @param  mixed $plugin
     * @return void
     * @throws ExceptionRuntimeException if invalid
     */
    
public function validatePlugin($plugin)
    {
        if (
$plugin instanceof StorageInterface) {
            
// we're okay
            
return;
        }

        throw new 
ExceptionRuntimeException(sprintf(
            
'Plugin of type %s is invalid; must implement %sStorageInterface',
            (
is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            
__NAMESPACE__
        
));
    }
}
Онлайн: 0
Реклама