if ($sModulePath = $oGetopt->getOption('module')) { if (!is_string($sModulePath)) { throw new \InvalidArgumentException('Module directory path expects string, "' . gettype($sModulePath) . '" given'); } 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)) {
/** * This method does the work of "reflecting" the file * * Uses Zend\Code\Scanner\FileScanner to gather file information * * @return void */ protected function reflect() { $scanner = new \Zend\Code\Scanner\FileScanner($this->filePath); $this->docComment = $scanner->getDocComment(); $this->requiredFiles = $scanner->getIncludes(); $this->classes = $scanner->getClasses(); $this->namespace = $scanner->getNamespaces(); $this->uses = $scanner->getUses(); }