From 088b5bfb754c142a2d935601bfe65350644d6df2 Mon Sep 17 00:00:00 2001 From: Naoray Date: Mon, 21 Oct 2019 09:32:16 +0000 Subject: [PATCH] Apply fixes from StyleCI [ci skip] [skip ci] --- src/Commands/AddPackage.php | 6 +++--- src/Commands/ClonePackage.php | 8 ++++---- src/Commands/Foundation/ModelMakeCommand.php | 2 +- src/Commands/Foundation/ObserverMakeCommand.php | 4 ++-- src/Commands/Foundation/PolicyMakeCommand.php | 4 ++-- src/Commands/Package/ComposerMakeCommand.php | 6 +++--- src/Commands/PackageMakeCommand.php | 12 ++++++------ src/Commands/Routing/ControllerMakeCommand.php | 8 ++++---- src/Commands/Standard/AnyMakeCommand.php | 6 +++--- src/Traits/CreatesPackageStubs.php | 8 ++++---- tests/Feature/ReplaceTest.php | 8 ++++---- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/Commands/AddPackage.php b/src/Commands/AddPackage.php index 4225b1c..5aaf7ad 100644 --- a/src/Commands/AddPackage.php +++ b/src/Commands/AddPackage.php @@ -74,7 +74,7 @@ public function handle() $this->updateComposer(); $this->call('package:save', [ - 'namespace' => ucfirst($this->vendor) . '\\' . ucfirst(Str::camel($this->packageName)), + 'namespace' => ucfirst($this->vendor).'\\'.ucfirst(Str::camel($this->packageName)), 'path' => $this->path, ]); } @@ -112,7 +112,7 @@ protected function addPackageToRootComposer() { $composer = json_decode(file_get_contents(base_path('composer.json')), true); - $composer['require'][$this->vendor . '/' . $this->packageName] = '*'; + $composer['require'][$this->vendor.'/'.$this->packageName] = '*'; file_put_contents( base_path('composer.json'), @@ -191,7 +191,7 @@ public function getPathInput() if (! $this->path = trim($this->argument('path'))) { $this->path = $this->anticipate('What is your package\'s path?', [ - '../packages/' . $this->packageName, 'packages/' . $this->packageName, + '../packages/'.$this->packageName, 'packages/'.$this->packageName, ]); } diff --git a/src/Commands/ClonePackage.php b/src/Commands/ClonePackage.php index d6c5451..58bae76 100644 --- a/src/Commands/ClonePackage.php +++ b/src/Commands/ClonePackage.php @@ -52,7 +52,7 @@ public function __construct(Filesystem $files) public function handle() { if ($this->files->isDirectory($target = $this->getTargetInput())) { - $this->error($target . ' directory already exists!'); + $this->error($target.' directory already exists!'); } if ($this->srcIsRemote()) { @@ -73,7 +73,7 @@ public function localClone() $this->error('Copying was not successfull!'); } - if ($this->files->isDirectory($vendor = $this->getTargetInput() . '/vendor')) { + if ($this->files->isDirectory($vendor = $this->getTargetInput().'/vendor')) { $this->files->deleteDirectory($vendor); $this->info('Removed vendor folder.'); @@ -87,9 +87,9 @@ public function localClone() */ public function gitClone() { - $this->runConsoleCommand('git clone ' . $this->argument('src') . ' ' . $this->argument('target'), getcwd()); + $this->runConsoleCommand('git clone '.$this->argument('src').' '.$this->argument('target'), getcwd()); - if ($this->files->isDirectory($git = $this->getTargetInput() . '/.git')) { + if ($this->files->isDirectory($git = $this->getTargetInput().'/.git')) { $this->files->deleteDirectory($git); $this->info('Removed .git folder.'); diff --git a/src/Commands/Foundation/ModelMakeCommand.php b/src/Commands/Foundation/ModelMakeCommand.php index 5fa4f49..d675e93 100644 --- a/src/Commands/Foundation/ModelMakeCommand.php +++ b/src/Commands/Foundation/ModelMakeCommand.php @@ -25,7 +25,7 @@ class ModelMakeCommand extends MakeModel */ protected function resolveDirectory() { - return $this->getDirInput() . 'src'; + return $this->getDirInput().'src'; } /** diff --git a/src/Commands/Foundation/ObserverMakeCommand.php b/src/Commands/Foundation/ObserverMakeCommand.php index 2e3b44e..3dc5ebd 100644 --- a/src/Commands/Foundation/ObserverMakeCommand.php +++ b/src/Commands/Foundation/ObserverMakeCommand.php @@ -25,7 +25,7 @@ class ObserverMakeCommand extends MakeObserver */ protected function resolveDirectory() { - return $this->getDirInput() . 'src'; + return $this->getDirInput().'src'; } /** @@ -40,7 +40,7 @@ protected function replaceModel($stub, $model) { $model = str_replace('/', '\\', $model); - $namespaceModel = $this->rootNamespace() . '\\' . $model; + $namespaceModel = $this->rootNamespace().'\\'.$model; if (Str::startsWith($model, '\\')) { $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub); diff --git a/src/Commands/Foundation/PolicyMakeCommand.php b/src/Commands/Foundation/PolicyMakeCommand.php index 44b2fb3..9cfe195 100644 --- a/src/Commands/Foundation/PolicyMakeCommand.php +++ b/src/Commands/Foundation/PolicyMakeCommand.php @@ -25,7 +25,7 @@ class PolicyMakeCommand extends MakePolicy */ protected function resolveDirectory() { - return $this->getDirInput() . 'src'; + return $this->getDirInput().'src'; } /** @@ -40,7 +40,7 @@ protected function replaceModel($stub, $model) { $model = str_replace('/', '\\', $model); - $namespaceModel = $this->rootNamespace() . '\\' . $model; + $namespaceModel = $this->rootNamespace().'\\'.$model; if (Str::startsWith($model, '\\')) { $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub); diff --git a/src/Commands/Package/ComposerMakeCommand.php b/src/Commands/Package/ComposerMakeCommand.php index 0e9d077..b938f5a 100644 --- a/src/Commands/Package/ComposerMakeCommand.php +++ b/src/Commands/Package/ComposerMakeCommand.php @@ -56,7 +56,7 @@ public function handle() */ protected function getStub() { - return __DIR__ . '/stubs/composer.stub'; + return __DIR__.'/stubs/composer.stub'; } /** @@ -84,7 +84,7 @@ protected function getNameInput() */ protected function composerNamespace() { - return ucfirst($this->vendorName()) . '\\\\' . Str::studly($this->packageName()) . '\\\\'; + return ucfirst($this->vendorName()).'\\\\'.Str::studly($this->packageName()).'\\\\'; } /** @@ -92,7 +92,7 @@ protected function composerNamespace() */ protected function composerProviderNamespace() { - return $this->composerNamespace() . Str::studly($this->packageName()) . 'ServiceProvider'; + return $this->composerNamespace().Str::studly($this->packageName()).'ServiceProvider'; } /** diff --git a/src/Commands/PackageMakeCommand.php b/src/Commands/PackageMakeCommand.php index 0a7cb16..404ff69 100644 --- a/src/Commands/PackageMakeCommand.php +++ b/src/Commands/PackageMakeCommand.php @@ -119,12 +119,12 @@ public function handle() $this->call('package:save', [ 'namespace' => $this->rootNamespace(), - 'path' => $this->dir . $this->packageName, + 'path' => $this->dir.$this->packageName, ]); $this->callSilent('package:add', [ 'name' => $this->packageName, - 'path' => $this->dir . $this->packageName, + 'path' => $this->dir.$this->packageName, 'vendor' => $this->vendor, 'branch' => 'master', '--no-interaction' => true, @@ -255,7 +255,7 @@ protected function createServiceProvider() { $this->call('package:provider', array_merge( [ - 'name' => $this->packageName() . 'ServiceProvider', + 'name' => $this->packageName().'ServiceProvider', ], $this->packageOptions() )); @@ -268,7 +268,7 @@ protected function createBaseTestCase() { $this->call('package:basetest', array_merge( [ - 'provider' => $this->packageName() . 'ServiceProvider', + 'provider' => $this->packageName().'ServiceProvider', ], $this->packageOptions() )); @@ -292,7 +292,7 @@ protected function packageOptions() */ protected function rootNamespace() { - return ucfirst($this->vendor) . '\\' . $this->packageName(); + return ucfirst($this->vendor).'\\'.$this->packageName(); } /** @@ -320,7 +320,7 @@ protected function alreadyExists($path) */ protected function packagePath() { - return $this->getDirectoryInput() . $this->packageName; + return $this->getDirectoryInput().$this->packageName; } /** diff --git a/src/Commands/Routing/ControllerMakeCommand.php b/src/Commands/Routing/ControllerMakeCommand.php index 480cccd..3dc9e26 100644 --- a/src/Commands/Routing/ControllerMakeCommand.php +++ b/src/Commands/Routing/ControllerMakeCommand.php @@ -25,7 +25,7 @@ class ControllerMakeCommand extends MakeController */ protected function resolveDirectory() { - return $this->getDirInput() . 'src'; + return $this->getDirInput().'src'; } /** @@ -39,9 +39,9 @@ protected function buildClass($name) { $class = parent::buildClass($name); - if (Str::contains($class, $this->rootNamespace() . 'Http\Controllers\Controller')) { + if (Str::contains($class, $this->rootNamespace().'Http\Controllers\Controller')) { return str_replace( - $this->rootNamespace() . 'Http\Controllers\Controller', + $this->rootNamespace().'Http\Controllers\Controller', 'Illuminate\Routing\Controller', $class ); @@ -124,7 +124,7 @@ protected function parseModel($model) $model = trim(str_replace('/', '\\', $model), '\\'); if (! Str::startsWith($model, $rootNamespace = $this->rootNamespace()) && ! Str::startsWith($model, $this->laravel->getNamespace())) { - $model = $rootNamespace . '\\' . $model; + $model = $rootNamespace.'\\'.$model; } return $model; diff --git a/src/Commands/Standard/AnyMakeCommand.php b/src/Commands/Standard/AnyMakeCommand.php index bd94a4d..5d9da7f 100644 --- a/src/Commands/Standard/AnyMakeCommand.php +++ b/src/Commands/Standard/AnyMakeCommand.php @@ -62,7 +62,7 @@ public function handle() */ protected function getStub() { - return __DIR__ . '/stubs/dummy.stub'; + return __DIR__.'/stubs/dummy.stub'; } /** @@ -72,7 +72,7 @@ protected function getStub() */ protected function resolveDirectory() { - return $this->getDirInput() . 'src'; + return $this->getDirInput().'src'; } /** @@ -84,7 +84,7 @@ protected function resolveDirectory() */ protected function getDefaultNamespace($rootNamespace) { - return $rootNamespace . '\\' . Str::plural(ucfirst(Str::camel($this->getCategoryInput()))); + return $rootNamespace.'\\'.Str::plural(ucfirst(Str::camel($this->getCategoryInput()))); } /** diff --git a/src/Traits/CreatesPackageStubs.php b/src/Traits/CreatesPackageStubs.php index 323aafb..813fd6a 100644 --- a/src/Traits/CreatesPackageStubs.php +++ b/src/Traits/CreatesPackageStubs.php @@ -28,7 +28,7 @@ protected function getPath($name) { $name = Str::replaceFirst($this->rootNamespace(), '', $name); - return $this->basePath() . str_replace('\\', '/', $name) . $this->getFileType(); + return $this->basePath().str_replace('\\', '/', $name).$this->getFileType(); } /** @@ -38,7 +38,7 @@ protected function getPath($name) */ protected function basePath() { - return base_path() . '/' . Str::finish($this->resolveDirectory(), '/'); + return base_path().'/'.Str::finish($this->resolveDirectory(), '/'); } /** @@ -78,7 +78,7 @@ protected function replacePackageName(&$stub) */ protected function rootNamespace() { - return $this->getNamespaceInput() . '\\'; + return $this->getNamespaceInput().'\\'; } /** @@ -139,7 +139,7 @@ protected function getDirInput() $dir = $this->ask('Where is your package stored (relative path)?'); } - return Str::endsWith($dir, '/') ? $dir : $dir . '/'; + return Str::endsWith($dir, '/') ? $dir : $dir.'/'; } /** diff --git a/tests/Feature/ReplaceTest.php b/tests/Feature/ReplaceTest.php index 0312295..b72d673 100644 --- a/tests/Feature/ReplaceTest.php +++ b/tests/Feature/ReplaceTest.php @@ -17,13 +17,13 @@ public function it_can_replace_a_files_old_string_with_new_ones() $old = 'TestPackageNamespace'; $new = 'NewPackageNamespace'; - $this->runConsoleCommand('/bin/echo -n \'# ' . $old . '\' >> ' . $fileName, $path); + $this->runConsoleCommand('/bin/echo -n \'# '.$old.'\' >> '.$fileName, $path); $this->runReplaceCommand($path, $old, $new); - $this->assertEquals($this->files->get($path . $fileName), '# ' . $new); + $this->assertEquals($this->files->get($path.$fileName), '# '.$new); - $this->files->delete($path . $fileName); + $this->files->delete($path.$fileName); } /** @test */ @@ -36,7 +36,7 @@ public function it_can_replace_all_files_old_string_with_new_ones_in_a_folder() $this->runReplaceCommand($path, $old, $new); $this->assertEquals( - json_decode($this->files->get($path . 'composer.json'), true)['name'], + json_decode($this->files->get($path.'composer.json'), true)['name'], strtolower($new) );