Пример #1
0
     }
     if (!is_dir($sModulePath)) {
         throw new \InvalidArgumentException('Module directory path "' . $sModulePath . '" does not exist');
     }
     $sModulePath = realpath($sModulePath);
 } else {
     $sModulePath = getcwd();
 }
 //Assert that mandatory files / dir exist into the deploy directory and are writable
 if (!is_readable($sModuleClassPath = $sModulePath . DIRECTORY_SEPARATOR . 'Module.php')) {
     throw new \InvalidArgumentException('Module class File "' . $sModuleClassPath . '" is unreadable');
 }
 $oFileScanner = new \Zend\Code\Scanner\FileScanner($sModuleClassPath);
 //Retrieve current module name
 foreach ($oFileScanner->getNamespaces() as $sNameSpace) {
     if ($oModuleClass = $oFileScanner->getClass($sNameSpace . '\\Module')) {
         $sCurrentModuleName = $sNameSpace;
         break;
     }
 }
 if (empty($sCurrentModuleName)) {
     throw new \InvalidArgumentException('"' . $sModuleClassPath . '" does not provide a "Module" class');
 }
 //Check "dir" option
 if (!($sDeployDirPath = $oGetopt->getOption('dir'))) {
     throw new \InvalidArgumentException('Deploy directory path is empty');
 }
 if (!is_string($sDeployDirPath)) {
     throw new \InvalidArgumentException('Deploy directory path expects string, "' . gettype($sDeployDirPath) . '" given');
 }
 //Create deploy dir if needed