Makes Exceptions extend the base classes, rather than the subclasses to avoid class redefinition errors. Makes PluginFactories define the interface using the base class rather than a subclass to avoid class_implements() to fail by testing for a class not in the hierarchy.
30 lines
829 B
PHP
30 lines
829 B
PHP
<?php
|
|
|
|
class SihnonFramework_Config_PluginFactory extends Sihnon_PluginFactory {
|
|
|
|
protected static $plugin_prefix = 'Sihnon_Config_Plugin_';
|
|
protected static $plugin_interface = 'SihnonFramework_Config_IPlugin';
|
|
protected static $plugin_dir = array(
|
|
SihnonFramework_Lib => 'SihnonFramework/Config/Plugin',
|
|
Sihnon_Lib => 'Sihnon/Config/Plugin/',
|
|
);
|
|
|
|
public static function init() {
|
|
|
|
}
|
|
|
|
public static function create($plugin, $options) {
|
|
self::ensureScanned();
|
|
|
|
if (! self::isValidPlugin($plugin)) {
|
|
throw new Sihnon_Exception_InvalidPluginName($plugin);
|
|
}
|
|
|
|
$classname = self::classname($plugin);
|
|
|
|
return call_user_func(array($classname, 'create'), $options);
|
|
}
|
|
|
|
}
|
|
|
|
?>
|