Example #1
0
 /**
  * @param $plugin_path
  * @return PluginBootstrap
  * @throws PluginManagerException
  */
 public function getPlugin($plugin_path)
 {
     list($namespace, $cls) = \File::getClassInfo($plugin_path);
     if ($namespace == null) {
         throw new PluginManagerException(sprintf("The plugin: '%s' doesn't have a namespace but the initializer expects a namespace in the class", $plugin_path));
     }
     $namespace_arr = explode("\\", $namespace);
     $name = end($namespace_arr);
     $cls_name = $namespace . "\\" . $cls;
     /** @var $object PluginBootstrap */
     $object = new $cls_name($name);
     return $object;
 }