3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
12 use Zend\ServiceManager\AbstractPluginManager
;
15 * Plugin manager implementation for the symmetric adapter instances.
17 * Enforces that symmetric adapters retrieved are instances of
18 * Symmetric\SymmetricInterface. Additionally, it registers a number of default
19 * symmetric adapters available.
21 class SymmetricPluginManager
extends AbstractPluginManager
24 * Default set of symmetric adapters
28 protected $invokableClasses = array(
29 'mcrypt' => 'Zend\Crypt\Symmetric\Mcrypt',
33 * Do not share by default
37 protected $shareByDefault = false;
42 * Checks that the adapter loaded is an instance
43 * of Symmetric\SymmetricInterface.
45 * @param mixed $plugin
47 * @throws Exception\InvalidArgumentException if invalid
49 public function validatePlugin($plugin)
51 if ($plugin instanceof Symmetric\SymmetricInterface
) {
56 throw new Exception\
InvalidArgumentException(sprintf(
57 'Plugin of type %s is invalid; must implement %s\Symmetric\SymmetricInterface',
58 (is_object($plugin) ?
get_class($plugin) : gettype($plugin)),