/** * Create service * * @param ServiceLocatorInterface $services * @return mixed */ public function createService(ServiceLocatorInterface $services) { $config = $services->get('Config'); $config = new Config($config['rdn_factory_plugins']); $plugins = new Plugin\PluginManager($config); $plugins->setServiceLocator($services); return $plugins; }
public function __call($name, $args = array()) { if (!$this->plugins instanceof ServiceLocatorInterface) { throw new \RuntimeException('No service locator set for factory. Set the service locator using the setServiceLocator() method first.'); } /** @var PluginInterface $plugin */ $plugin = $this->plugins->get($name); $plugin->setFactory($this); if (is_callable($plugin)) { return call_user_func_array($plugin, $args); } return $plugin; }