Вход Регистрация
Файл: concrete5.7.5.6/concrete/vendor/zendframework/zend-i18n/src/Translator/LoaderPluginManager.php
Строк: 95
<?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 ZendI18nTranslator;

use 
ZendI18nException;
use 
ZendServiceManagerAbstractPluginManager;

/**
 * Plugin manager implementation for translation loaders.
 *
 * Enforces that loaders retrieved are either instances of
 * LoaderFileLoaderInterface or LoaderRemoteLoaderInterface. Additionally,
 * it registers a number of default loaders.
 */
class LoaderPluginManager extends AbstractPluginManager
{
    
/**
     * Default set of loaders.
     *
     * @var array
     */
    
protected $invokableClasses = array(
        
'gettext'  => 'ZendI18nTranslatorLoaderGettext',
        
'ini'      => 'ZendI18nTranslatorLoaderIni',
        
'phparray' => 'ZendI18nTranslatorLoaderPhpArray',
    );

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

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