Esempio n. 1
0
 /**
  * Call a public method of a registered Plugin.
  * @param Plugin $caller
  * @param string $pluginId
  * @param string $pluginMethod
  * @param array $methodArgs
  * @throws Exception
  */
 function callPublicMethod(Plugin $caller, $pluginId, $pluginMethod, $methodArgs)
 {
     if (!isset($this->loadedPlugins[$pluginId])) {
         throw new Exception('Plugin "' . $pluginId . '" which you want to call a method from, does not exist!');
     }
     $plugin = $this->loadedPlugins[$pluginId];
     array_push($methodArgs, $caller->getId());
     $method = $plugin->getPublicMethod($pluginMethod);
     return $method->invokeArgs($plugin, $methodArgs);
 }