Commit ff462548 authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

fix code styles

parent 747f3465
...@@ -10,3 +10,4 @@ Homestead.json ...@@ -10,3 +10,4 @@ Homestead.json
Homestead.yaml Homestead.yaml
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
.php_cs.cache
...@@ -3,17 +3,18 @@ ...@@ -3,17 +3,18 @@
namespace App\Console\Commands\GatewayCommands; namespace App\Console\Commands\GatewayCommands;
use Illuminate\Console\GeneratorCommand; use Illuminate\Console\GeneratorCommand;
abstract class BaseGatewayFileGenerator extends GeneratorCommand { abstract class BaseGatewayFileGenerator extends GeneratorCommand
{
/** /**
* Get the default namespace for the class. * Get the default namespace for the class.
* *
* @param string $rootNamespace * @param string $rootNamespace
* @return string * @return string
*/ */
protected function getDefaultNamespace($rootNamespace) { protected function getDefaultNamespace($rootNamespace)
{
$namespace = $rootNamespace . '\\Gateways'; $namespace = $rootNamespace . '\\Gateways';
foreach (explode('/', $this->getNameInput()) as $folder) { foreach (explode('/', $this->getNameInput()) as $folder) {
$namespace .= '\\' . $folder; $namespace .= '\\' . $folder;
...@@ -27,7 +28,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand { ...@@ -27,7 +28,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getNamespace($name) { protected function getNamespace($name)
{
return $this->getDefaultNamespace($this->rootNamespace()); return $this->getDefaultNamespace($this->rootNamespace());
} }
...@@ -38,7 +40,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand { ...@@ -38,7 +40,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function replaceClass($stub, $name) { protected function replaceClass($stub, $name)
{
$name = last(explode('\\', $name)); $name = last(explode('\\', $name));
return parent::replaceClass($stub, $name); return parent::replaceClass($stub, $name);
} }
...@@ -48,7 +51,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand { ...@@ -48,7 +51,8 @@ abstract class BaseGatewayFileGenerator extends GeneratorCommand {
* *
* @return string * @return string
*/ */
public function rootNamespace() { public function rootNamespace()
{
return 'Source'; return 'Source';
} }
} }
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
namespace App\Console\Commands\GatewayCommands; namespace App\Console\Commands\GatewayCommands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
class CreateGateway extends Command { class CreateGateway extends Command
{
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -24,7 +24,8 @@ class CreateGateway extends Command { ...@@ -24,7 +24,8 @@ class CreateGateway extends Command {
/** /**
* Execute the console command. * Execute the console command.
*/ */
public function handle(): void { public function handle(): void
{
$name = $this->argument('name'); $name = $this->argument('name');
$this->call( $this->call(
'gateway:create-interface', 'gateway:create-interface',
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
namespace App\Console\Commands\GatewayCommands; namespace App\Console\Commands\GatewayCommands;
class GenerateBaseGateway extends BaseGatewayFileGenerator
class GenerateBaseGateway extends BaseGatewayFileGenerator { {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -31,7 +31,8 @@ class GenerateBaseGateway extends BaseGatewayFileGenerator { ...@@ -31,7 +31,8 @@ class GenerateBaseGateway extends BaseGatewayFileGenerator {
* *
* @return string * @return string
*/ */
protected function getStub() { protected function getStub()
{
return __DIR__ . '/stubs/Repository.stub'; return __DIR__ . '/stubs/Repository.stub';
} }
...@@ -41,7 +42,8 @@ class GenerateBaseGateway extends BaseGatewayFileGenerator { ...@@ -41,7 +42,8 @@ class GenerateBaseGateway extends BaseGatewayFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getPath($name) { protected function getPath($name)
{
$baseName = $this->getNameInput(); $baseName = $this->getNameInput();
$className = last(explode('/', $baseName)); $className = last(explode('/', $baseName));
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
namespace App\Console\Commands\GatewayCommands; namespace App\Console\Commands\GatewayCommands;
class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator
class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator { {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -31,7 +31,8 @@ class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator { ...@@ -31,7 +31,8 @@ class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator {
* *
* @return string * @return string
*/ */
protected function getStub() { protected function getStub()
{
$type = $this->argument('type'); $type = $this->argument('type');
return __DIR__ . '/stubs/' . ucfirst($type) . '.stub'; return __DIR__ . '/stubs/' . ucfirst($type) . '.stub';
} }
...@@ -42,7 +43,8 @@ class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator { ...@@ -42,7 +43,8 @@ class GenerateGatewayRepositoryType extends BaseGatewayFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getPath($name) { protected function getPath($name)
{
$name = $this->getNameInput(); $name = $this->getNameInput();
$type = $this->argument('type'); $type = $this->argument('type');
return $this->laravel->basePath() . '/src/Gateways/' . $name . '/' . $type . $name . 'Repository.php'; return $this->laravel->basePath() . '/src/Gateways/' . $name . '/' . $type . $name . 'Repository.php';
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
namespace App\Console\Commands\GatewayCommands; namespace App\Console\Commands\GatewayCommands;
class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator
class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator { {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -31,7 +31,8 @@ class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator { ...@@ -31,7 +31,8 @@ class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator {
* *
* @return string * @return string
*/ */
protected function getStub() { protected function getStub()
{
return __DIR__ . '/stubs/Provider.stub'; return __DIR__ . '/stubs/Provider.stub';
} }
...@@ -41,7 +42,8 @@ class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator { ...@@ -41,7 +42,8 @@ class GenerateGatewayServiceProvider extends BaseGatewayFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getPath($name) { protected function getPath($name)
{
$fullName = $this->getNameInput(); $fullName = $this->getNameInput();
$className = last(explode('/', $fullName)); $className = last(explode('/', $fullName));
......
...@@ -4,14 +4,16 @@ namespace App\Console\Commands\UseCaseCommands; ...@@ -4,14 +4,16 @@ namespace App\Console\Commands\UseCaseCommands;
use Illuminate\Console\GeneratorCommand; use Illuminate\Console\GeneratorCommand;
abstract class BaseUseCaseFileGenerator extends GeneratorCommand { abstract class BaseUseCaseFileGenerator extends GeneratorCommand
{
/** /**
* Get the default namespace for the class. * Get the default namespace for the class.
* *
* @param string $rootNamespace * @param string $rootNamespace
* @return string * @return string
*/ */
protected function getDefaultNamespace($rootNamespace) { protected function getDefaultNamespace($rootNamespace)
{
$namespace = $rootNamespace . '\\UseCases'; $namespace = $rootNamespace . '\\UseCases';
foreach (explode('/', $this->getNameInput()) as $folder) { foreach (explode('/', $this->getNameInput()) as $folder) {
$namespace .= '\\' . $folder; $namespace .= '\\' . $folder;
...@@ -25,7 +27,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand { ...@@ -25,7 +27,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getNamespace($name) { protected function getNamespace($name)
{
return $this->getDefaultNamespace($this->rootNamespace()); return $this->getDefaultNamespace($this->rootNamespace());
} }
...@@ -36,7 +39,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand { ...@@ -36,7 +39,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function replaceClass($stub, $name) { protected function replaceClass($stub, $name)
{
$name = last(explode('\\', $name)); $name = last(explode('\\', $name));
return parent::replaceClass($stub, $name); return parent::replaceClass($stub, $name);
} }
...@@ -46,7 +50,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand { ...@@ -46,7 +50,8 @@ abstract class BaseUseCaseFileGenerator extends GeneratorCommand {
* *
* @return string * @return string
*/ */
public function rootNamespace() { public function rootNamespace()
{
return 'Source'; return 'Source';
} }
} }
...@@ -4,7 +4,8 @@ namespace App\Console\Commands\UseCaseCommands; ...@@ -4,7 +4,8 @@ namespace App\Console\Commands\UseCaseCommands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
class CreateUseCase extends Command { class CreateUseCase extends Command
{
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -22,7 +23,8 @@ class CreateUseCase extends Command { ...@@ -22,7 +23,8 @@ class CreateUseCase extends Command {
/** /**
* Execute the console command. * Execute the console command.
*/ */
public function handle(): void { public function handle(): void
{
$name = $this->argument('name'); $name = $this->argument('name');
$this->call( $this->call(
'use-case:create-use-case', 'use-case:create-use-case',
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
namespace App\Console\Commands\UseCaseCommands; namespace App\Console\Commands\UseCaseCommands;
class GenerateBaseUseCase extends BaseUseCaseFileGenerator { class GenerateBaseUseCase extends BaseUseCaseFileGenerator
{
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -29,7 +30,8 @@ class GenerateBaseUseCase extends BaseUseCaseFileGenerator { ...@@ -29,7 +30,8 @@ class GenerateBaseUseCase extends BaseUseCaseFileGenerator {
* *
* @return string * @return string
*/ */
protected function getStub() { protected function getStub()
{
return __DIR__ . '/stubs/BaseUseCase.stub'; return __DIR__ . '/stubs/BaseUseCase.stub';
} }
...@@ -39,7 +41,8 @@ class GenerateBaseUseCase extends BaseUseCaseFileGenerator { ...@@ -39,7 +41,8 @@ class GenerateBaseUseCase extends BaseUseCaseFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getPath($name) { protected function getPath($name)
{
$baseName = $this->getNameInput(); $baseName = $this->getNameInput();
$className = last(explode('/', $baseName)); $className = last(explode('/', $baseName));
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
namespace App\Console\Commands\UseCaseCommands; namespace App\Console\Commands\UseCaseCommands;
class GenerateUseCase extends BaseUseCaseFileGenerator { class GenerateUseCase extends BaseUseCaseFileGenerator
{
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -29,7 +30,8 @@ class GenerateUseCase extends BaseUseCaseFileGenerator { ...@@ -29,7 +30,8 @@ class GenerateUseCase extends BaseUseCaseFileGenerator {
* *
* @return string * @return string
*/ */
protected function getStub() { protected function getStub()
{
return __DIR__ . '/stubs/UseCase.stub'; return __DIR__ . '/stubs/UseCase.stub';
} }
...@@ -39,7 +41,8 @@ class GenerateUseCase extends BaseUseCaseFileGenerator { ...@@ -39,7 +41,8 @@ class GenerateUseCase extends BaseUseCaseFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getPath($name) { protected function getPath($name)
{
$name = $this->getNameInput(); $name = $this->getNameInput();
$className = last(explode('/', $name)); $className = last(explode('/', $name));
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
namespace App\Console\Commands\UseCaseCommands; namespace App\Console\Commands\UseCaseCommands;
class GenerateUseCasePresenter extends BaseUseCaseFileGenerator { class GenerateUseCasePresenter extends BaseUseCaseFileGenerator
{
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -29,7 +30,8 @@ class GenerateUseCasePresenter extends BaseUseCaseFileGenerator { ...@@ -29,7 +30,8 @@ class GenerateUseCasePresenter extends BaseUseCaseFileGenerator {
* *
* @return string * @return string
*/ */
protected function getStub() { protected function getStub()
{
return __DIR__ . '/stubs/presenter.stub'; return __DIR__ . '/stubs/presenter.stub';
} }
...@@ -39,7 +41,8 @@ class GenerateUseCasePresenter extends BaseUseCaseFileGenerator { ...@@ -39,7 +41,8 @@ class GenerateUseCasePresenter extends BaseUseCaseFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getPath($name) { protected function getPath($name)
{
$name = $this->getNameInput(); $name = $this->getNameInput();
return $this->laravel->basePath() . '/src/UseCases/' . $name . '/Presenter.php'; return $this->laravel->basePath() . '/src/UseCases/' . $name . '/Presenter.php';
} }
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
namespace App\Console\Commands\UseCaseCommands; namespace App\Console\Commands\UseCaseCommands;
class GenerateUseCasePresenterType extends BaseUseCaseFileGenerator { class GenerateUseCasePresenterType extends BaseUseCaseFileGenerator
{
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -29,7 +30,8 @@ class GenerateUseCasePresenterType extends BaseUseCaseFileGenerator { ...@@ -29,7 +30,8 @@ class GenerateUseCasePresenterType extends BaseUseCaseFileGenerator {
* *
* @return string * @return string
*/ */
protected function getStub() { protected function getStub()
{
return __DIR__ . '/stubs/PresenterType.stub'; return __DIR__ . '/stubs/PresenterType.stub';
} }
...@@ -39,7 +41,8 @@ class GenerateUseCasePresenterType extends BaseUseCaseFileGenerator { ...@@ -39,7 +41,8 @@ class GenerateUseCasePresenterType extends BaseUseCaseFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getPath($name) { protected function getPath($name)
{
$name = $this->getNameInput(); $name = $this->getNameInput();
$type = $this->argument('type'); $type = $this->argument('type');
return $this->laravel->basePath() . '/src/UseCases/' . $name . '/' . $type . 'Presenter.php'; return $this->laravel->basePath() . '/src/UseCases/' . $name . '/' . $type . 'Presenter.php';
...@@ -52,7 +55,8 @@ class GenerateUseCasePresenterType extends BaseUseCaseFileGenerator { ...@@ -52,7 +55,8 @@ class GenerateUseCasePresenterType extends BaseUseCaseFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function replaceClass($stub, $name) { protected function replaceClass($stub, $name)
{
$type = $this->argument('type'); $type = $this->argument('type');
$name = $type . 'Presenter'; $name = $type . 'Presenter';
return parent::replaceClass($stub, $name); return parent::replaceClass($stub, $name);
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
namespace App\Console\Commands\UseCaseCommands; namespace App\Console\Commands\UseCaseCommands;
class GenerateUseCaseResponseModel extends BaseUseCaseFileGenerator { class GenerateUseCaseResponseModel extends BaseUseCaseFileGenerator
{
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
...@@ -29,7 +30,8 @@ class GenerateUseCaseResponseModel extends BaseUseCaseFileGenerator { ...@@ -29,7 +30,8 @@ class GenerateUseCaseResponseModel extends BaseUseCaseFileGenerator {
* *
* @return string * @return string
*/ */
protected function getStub() { protected function getStub()
{
return __DIR__ . '/stubs/ResponseModel.stub'; return __DIR__ . '/stubs/ResponseModel.stub';
} }
...@@ -39,7 +41,8 @@ class GenerateUseCaseResponseModel extends BaseUseCaseFileGenerator { ...@@ -39,7 +41,8 @@ class GenerateUseCaseResponseModel extends BaseUseCaseFileGenerator {
* @param string $name * @param string $name
* @return string * @return string
*/ */
protected function getPath($name) { protected function getPath($name)
{
$name = $this->getNameInput(); $name = $this->getNameInput();
return $this->laravel->basePath() . '/src/UseCases/' . $name . '/ResponseModel.php'; return $this->laravel->basePath() . '/src/UseCases/' . $name . '/ResponseModel.php';
} }
......