diff --git a/module/VuFind/src/VuFind/ServiceManager/AbstractPluginManager.php b/module/VuFind/src/VuFind/ServiceManager/AbstractPluginManager.php index 3201131af9229cdd5c1d912c772c0a55f21822c5..d7abc47fcd09c1ea09acaaed244026221ba15bf5 100644 --- a/module/VuFind/src/VuFind/ServiceManager/AbstractPluginManager.php +++ b/module/VuFind/src/VuFind/ServiceManager/AbstractPluginManager.php @@ -40,8 +40,6 @@ use Zend\ServiceManager\AbstractPluginManager as Base, */ abstract class AbstractPluginManager extends Base { - protected $expectedInterface; - /** * Validate the plugin * @@ -55,11 +53,20 @@ abstract class AbstractPluginManager extends Base */ public function validatePlugin($plugin) { - if (!($plugin instanceof $this->expectedInterface)) { + $expectedInterface = $this->getExpectedInterface(); + if (!($plugin instanceof $expectedInterface)) { throw new ServiceManagerRuntimeException( 'Plugin ' . get_class($plugin) . ' does not belong to ' - . $this->expectedInterface + . $expectedInterface ); } } + + /** + * Return the name of the base class or interface that plug-ins must conform + * to. + * + * @return string + */ + abstract protected function getExpectedInterface(); } \ No newline at end of file diff --git a/module/VuFind/src/VuFind/Session/PluginManager.php b/module/VuFind/src/VuFind/Session/PluginManager.php index fc71c7c13ed481de3eae5fee6378c64555b7832a..3aee7b72f54f2bd2180584dd80d0f76ebdcfef46 100644 --- a/module/VuFind/src/VuFind/Session/PluginManager.php +++ b/module/VuFind/src/VuFind/Session/PluginManager.php @@ -40,16 +40,13 @@ use Zend\ServiceManager\ConfigInterface; class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager { /** - * Constructor + * Return the name of the base class or interface that plug-ins must conform + * to. * - * Add a default initializer to ensure the plugin is valid after instance - * creation. - * - * @param null|ConfigInterface $configuration Configuration + * @return string */ - public function __construct(ConfigInterface $configuration = null) + protected function getExpectedInterface() { - $this->expectedInterface = 'Zend\Session\SaveHandler\SaveHandlerInterface'; - parent::__construct($configuration); + return 'Zend\Session\SaveHandler\SaveHandlerInterface'; } } \ No newline at end of file