laravel['modules']; return $module->config('paths.generator.support.namespace') ?: $module->config('paths.generator.support.path', 'Support'); } protected function getArguments() { return [ ['module', InputArgument::REQUIRED, 'The name of module.'], ]; } protected function getOptions() { return [ ['support', null, InputOption::VALUE_OPTIONAL, 'Unused for now.', null], ]; } protected function getTemplateContents() { $module = $this->laravel['modules']->findOrFail($this->getModuleName()); return (new Stub('/Moduleinfo.stub', [ 'NAMESPACE' => $this->getClassNamespace($module), 'MODULE' => $this->getModuleName(), ]))->render(); } /** * @return array|string */ protected function getPathName() { $pathName = Str::studly($this->option('support')); if (Str::contains(strtolower($pathName), 'support') === false) { $pathName .= 'ModuleInfo'; } return $pathName; } protected function getDestinationFilePath() { $path = $this->laravel['modules']->getModulePath($this->getModuleName()); $helperPath = GenerateConfigReader::read('support'); return $path.$helperPath->getPath().'/'.$this->getPathName().'.php'; } protected function getFileName() { return 'ModuleInfo'; } /** * Get class namespace. * * @param \mpba\Modules\Module $module * @return string */ public function getClassNamespace($module) { $extra = str_replace($this->getClass(), '', $this->argument($this->argumentName)); $extra = str_replace('/', '\\', $extra); $namespace = $this->laravel['modules']->config('namespace'); $namespace .= '\\'.$module->getStudlyName(); $namespace .= '\\'.$this->getDefaultNamespace(); $namespace .= '\\'.$extra; $namespace = str_replace('/', '\\', $namespace); return trim($namespace, '\\'); } }