Source of file PluginManager.php
Size: 1,968 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Cache/Storage/PluginManager.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | <?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 Zend\Cache\Storage; use Zend\Cache\Exception; use Zend\ServiceManager\AbstractPluginManager; /** * Plugin manager implementation for cache plugins * * Enforces that plugins retrieved are instances of * Plugin\PluginInterface. Additionally, it registers a number of default * plugins available. */ class PluginManager extends AbstractPluginManager { /** * Default set of plugins * * @var array */ protected $invokableClasses = array( 'clearexpiredbyfactor' => 'Zend\Cache\Storage\Plugin\ClearExpiredByFactor', 'exceptionhandler' => 'Zend\Cache\Storage\Plugin\ExceptionHandler', 'ignoreuserabort' => 'Zend\Cache\Storage\Plugin\IgnoreUserAbort', 'optimizebyfactor' => 'Zend\Cache\Storage\Plugin\OptimizeByFactor', 'serializer' => 'Zend\Cache\Storage\Plugin\Serializer', ); /** * Do not share by default * * @var array */ protected $shareByDefault = false; /** * Validate the plugin * * Checks that the plugin loaded is an instance of Plugin\PluginInterface. * * @param mixed $plugin * @return void * @throws Exception\RuntimeException if invalid */ public function validatePlugin($plugin) { if ($plugin instanceof Plugin\PluginInterface) { // we're okay return; } throw new Exception\RuntimeException(sprintf( 'Plugin of type %s is invalid; must implement %s\Plugin\PluginInterface', (is_object($plugin) ? get_class($plugin) : gettype($plugin)), __NAMESPACE__ )); } } |