Beispiel #1
0
 /**
  * Get an instance of the module installer class
  * @param \Zikula\Core\AbstractModule|null $module
  * @param array $modInfo
  * @return \Zikula_AbstractInstaller|\Zikula\Core\ExtensionInstallerInterface
  */
 private function getInstaller($module, array $modInfo)
 {
     if (null === $module) {
         $className = ucwords($modInfo['name']) . '\\' . ucwords($modInfo['name']) . 'Installer';
         $classNameOld = ucwords($modInfo['name']) . '_Installer';
         $className = class_exists($className) ? $className : $classNameOld;
     } else {
         $className = $module->getInstallerClass();
     }
     $reflectionInstaller = new ReflectionClass($className);
     if ($reflectionInstaller->isSubclassOf('Zikula_AbstractInstaller')) {
         $installer = $reflectionInstaller->newInstanceArgs(array($this->serviceManager, $module));
     } elseif ($reflectionInstaller->isSubclassOf('\\Zikula\\Core\\ExtensionInstallerInterface')) {
         $installer = $reflectionInstaller->newInstance();
         $installer->setBundle($module);
         if ($installer instanceof ContainerAwareInterface) {
             $installer->setContainer($this->getContainer());
         }
     } else {
         throw new \RuntimeException($this->__f("%s must be an instance of Zikula_AbstractInstaller or implement ExtensionInstallerInterface", $className));
     }
     return $installer;
 }