diff --git a/src/Common/Presentation/CLI/CreateDomainCommand.php b/src/Common/Presentation/CLI/CreateDomainCommand.php new file mode 100644 index 0000000..c13247b --- /dev/null +++ b/src/Common/Presentation/CLI/CreateDomainCommand.php @@ -0,0 +1,85 @@ +argument('boundedContext') . '/' . $this->argument('domainName'); + + // Application + $applicationStructure = [ + 'DTO', + 'Repositories/Eloquent', + 'Exceptions', + 'Jobs', + 'Providers', + 'Mappers', + 'UseCases/Commands', + 'UseCases/Queries', + ]; + foreach ($applicationStructure as $applicationDirectory) { + File::makeDirectory($basePath . '/Application/' . $applicationDirectory, 0755, true); + touch($basePath . '/Application/' . $applicationDirectory . '/.gitkeep'); + } + + // Domain + $domainStructure = [ + 'Exceptions', + 'Factories', + 'Model', + 'Policies', + 'Repositories', + 'Services' + ]; + foreach ($domainStructure as $domainDirectory) { + File::makeDirectory($basePath . '/Domain/' . $domainDirectory, 0755, true); + touch($basePath . '/Domain/' . $domainDirectory . '/.gitkeep'); + } + + // Infrastructure + $infrastructureStructure = [ + 'EloquentModels' + ]; + foreach ($infrastructureStructure as $infrastructureDirectory) { + File::makeDirectory($basePath . '/Infrastructure/' . $infrastructureDirectory, 0755, true); + touch($basePath . '/Infrastructure/' . $infrastructureDirectory . '/.gitkeep'); + } + + // Presentation + $presentationStructure = [ + 'API', + 'CLI', + 'HTTP' + ]; + foreach ($presentationStructure as $presentationDirectory) { + File::makeDirectory($basePath . '/Presentation/' . $presentationDirectory, 0755, true); + touch($basePath . '/Presentation/' . $presentationDirectory . '/.gitkeep'); + } + + return 1; + } +}