Пример #1
0
 /**
  * Handles all required dependencies.
  * 
  * @access public
  * @param string $moduleNamespace
  * @param array $dependencies
  * @param boolean $activateDependencies
  * 
  * @throws Zepi\Turbo\Exception Can not activate the module "$moduleNamespace". The module requires the module "$dependencyModuleNamespace" which isn't activated.
  */
 protected function handleRequiredDependencies($moduleNamespace, $dependencies, $activateDependencies)
 {
     foreach ($dependencies as $dependencyModuleNamespace => $version) {
         $dependencyModuleNamespace = Framework::prepareNamespace($dependencyModuleNamespace);
         $module = $this->getModule($dependencyModuleNamespace);
         if ($module === false) {
             if ($activateDependencies) {
                 $this->activateModule($dependencyModuleNamespace, $activateDependencies);
             } else {
                 throw new Exception('Can not activate the module "' . $moduleNamespace . '". The module requires the module "' . $dependencyModuleNamespace . '" which isn\'t activated.');
             }
         }
     }
 }
Пример #2
0
 public function testPrepareNamespace()
 {
     $preparedNamespace = \Zepi\Turbo\Framework::prepareNamespace('Zepi\\Turbo');
     $this->assertEquals('\\Zepi\\Turbo\\', $preparedNamespace);
 }
Пример #3
0
 /**
  * Returns the directory for the given module namespace
  * 
  * @access protected
  * @param string $namespace
  * @return false|string
  */
 protected function buildPathFromNamespace($namespace)
 {
     // Prepare the namespace
     $namespace = Framework::prepareNamespace($namespace);
     // Load the module
     $moduleManager = $this->framework->getModuleManager();
     $module = $moduleManager->getModule($namespace);
     if ($module === false) {
         return false;
     }
     return $module->getDirectory();
 }