/**
  *
  * @param string $deploymentDescriptorPath absolute path of descriptor file
  * $return array module deployment descriptor
  */
 public function deploy()
 {
     $compontens = [];
     $models = [];
     $modules = [];
     $moduleInfo = [];
     $moduleInfoFile = new File("{$this->modulePath}/" . ModuleInfo::MODULE_INFO_FILENAME);
     if ($moduleInfoFile->exists()) {
         $moduleInfo = $moduleInfoFile->includeFile();
     } else {
         $this->log->console("Missing module info file in {$this->modulePath}", null, Log::WARNING);
     }
     $componentsDir = new Directory("{$this->modulePath}/" . self::COMPONENTS_FOLDER);
     if ($componentsDir->exists()) {
         $compontens = $componentsDir->getFiles(true, self::PHP_FILE_FILTER);
     }
     $modelsDir = new Directory("{$this->modulePath}/" . self::MODELS_FOLDER);
     if ($modelsDir->exists()) {
         $modelsTmp = $modelsDir->getFiles(true, self::PHP_FILE_FILTER);
         foreach ($modelsTmp as $modelPath) {
             $class = substr($modelPath, strrpos($this->modulePath, DS) + 1);
             // remove path
             $class = substr($class, 0, -4);
             // remove .php extendsion
             $class = str_replace(DS, '\\', $class);
             // direectory separator to namespace separator
             $models[$class] = $modelPath;
         }
     }
     $modulesDir = new Directory("{$this->modulePath}/" . self::MODULES_FOLDER);
     if ($modulesDir->exists()) {
         foreach ($modulesDir->getDirectories() as $subModulePath) {
             $moduleName = substr(str_replace($modulesDir->getPath(), '', $subModulePath), 1);
             $subModuleDeployer = new ModuleDeployer($subModulePath);
             $modules[$moduleName] = $subModuleDeployer->deploy();
         }
     }
     return ['path' => $this->modulePath, 'compontents' => $compontens, 'modules' => $modules, 'models' => $models, 'info' => $moduleInfo];
 }
 /**
  *
  * @param string $deploymentDescriptorPath absolute path of descriptor file
  */
 public function deploy()
 {
     $this->log->console("DEPLOY =============================================================\n\n");
     $watch = new Watch();
     $watch->start();
     $this->clear();
     $deployment = [];
     foreach ($this->applicationPaths as $application => $applicationPath) {
         $moduleDir = new Directory($applicationPath);
         $this->scanApplications($application, $applicationPath);
         if ($moduleDir->exists()) {
             $moduleDeployer = new ModuleDeployer($moduleDir->getPath(), true);
             $deployment[$application] = $moduleDeployer->deploy();
         }
     }
     $this->scanModules($deployment, '');
     $arrayIterator = new \RecursiveArrayIterator($deployment);
     $deploymentIterator = new \RecursiveIteratorIterator($arrayIterator);
     foreach ($deploymentIterator as $key => $classPath) {
         if (is_file($classPath)) {
             include_once $classPath;
         }
     }
     $this->scanComponents();
     $this->exportDeploymentDescriptor();
     $this->log->console("Deploy time: \t {$watch->stop()}\n\n");
 }