Created
August 31, 2021 22:40
-
-
Save thewasta/9bc437c28e9f7af537a1dd35baf5e2c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Console; | |
class CommandHexagonal extends ParentHexagonalCommand | |
{ | |
public function handle(): void | |
{ | |
$this->parseSignatures(); | |
$this->makeApplication(); | |
if ($this->files->isDirectory($this->namespace) && $this->files->isDirectory($this->entity)) { | |
$this->comment("New"); | |
} | |
dd("aaa"); | |
} | |
protected function parseSignatures(): void | |
{ | |
$this->namespace = $this->getStub(); | |
$this->context = $this->joinDirectories($this->namespace, $this->argument("context")); | |
$this->entity = $this->joinDirectories($this->context, $this->argument("entity")); | |
$this->isQuery = (bool)$this->argument("isQuery"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Console; | |
use Illuminate\Console\GeneratorCommand; | |
abstract class ParentHexagonalCommand extends GeneratorCommand | |
{ | |
protected $layers = ["Application", "Domain", "Infrastructure", "Entrypoint"]; | |
protected $signature = "hexagonal:command {context} {entity} {isQuery}"; | |
protected $description = "A command"; | |
protected $repository = "Eloquent"; | |
protected $namespace; | |
protected $context; | |
protected $entity; | |
protected $isQuery; | |
final protected function makeApplication(): void | |
{ | |
$this->files->makeDirectory($this->context); | |
$this->files->makeDirectory($this->joinDirectories($this->context, "Application")); | |
} | |
final protected function joinDirectories(...$arguments): string | |
{ | |
return implode(DIRECTORY_SEPARATOR, $arguments); | |
} | |
final protected function makeDomain(): void | |
{ | |
} | |
protected function getStub(): string | |
{ | |
return app_path().DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."src".DIRECTORY_SEPARATOR."Blackboard"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment