Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #62 from Naoray/analysis-8AZloG
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
Naoray authored Oct 21, 2019
2 parents 230ba64 + 088b5bf commit 834fbdc
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
6 changes: 3 additions & 3 deletions src/Commands/AddPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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,
]);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Commands/ClonePackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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.');
Expand All @@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Foundation/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ModelMakeCommand extends MakeModel
*/
protected function resolveDirectory()
{
return $this->getDirInput() . 'src';
return $this->getDirInput().'src';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/Foundation/ObserverMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ObserverMakeCommand extends MakeObserver
*/
protected function resolveDirectory()
{
return $this->getDirInput() . 'src';
return $this->getDirInput().'src';
}

/**
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/Foundation/PolicyMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PolicyMakeCommand extends MakePolicy
*/
protected function resolveDirectory()
{
return $this->getDirInput() . 'src';
return $this->getDirInput().'src';
}

/**
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/Commands/Package/ComposerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function handle()
*/
protected function getStub()
{
return __DIR__ . '/stubs/composer.stub';
return __DIR__.'/stubs/composer.stub';
}

/**
Expand Down Expand Up @@ -84,15 +84,15 @@ protected function getNameInput()
*/
protected function composerNamespace()
{
return ucfirst($this->vendorName()) . '\\\\' . Str::studly($this->packageName()) . '\\\\';
return ucfirst($this->vendorName()).'\\\\'.Str::studly($this->packageName()).'\\\\';
}

/**
* @return string
*/
protected function composerProviderNamespace()
{
return $this->composerNamespace() . Str::studly($this->packageName()) . 'ServiceProvider';
return $this->composerNamespace().Str::studly($this->packageName()).'ServiceProvider';
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/Commands/PackageMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -255,7 +255,7 @@ protected function createServiceProvider()
{
$this->call('package:provider', array_merge(
[
'name' => $this->packageName() . 'ServiceProvider',
'name' => $this->packageName().'ServiceProvider',
],
$this->packageOptions()
));
Expand All @@ -268,7 +268,7 @@ protected function createBaseTestCase()
{
$this->call('package:basetest', array_merge(
[
'provider' => $this->packageName() . 'ServiceProvider',
'provider' => $this->packageName().'ServiceProvider',
],
$this->packageOptions()
));
Expand All @@ -292,7 +292,7 @@ protected function packageOptions()
*/
protected function rootNamespace()
{
return ucfirst($this->vendor) . '\\' . $this->packageName();
return ucfirst($this->vendor).'\\'.$this->packageName();
}

/**
Expand Down Expand Up @@ -320,7 +320,7 @@ protected function alreadyExists($path)
*/
protected function packagePath()
{
return $this->getDirectoryInput() . $this->packageName;
return $this->getDirectoryInput().$this->packageName;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Commands/Routing/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ControllerMakeCommand extends MakeController
*/
protected function resolveDirectory()
{
return $this->getDirInput() . 'src';
return $this->getDirInput().'src';
}

/**
Expand All @@ -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
);
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/Commands/Standard/AnyMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function handle()
*/
protected function getStub()
{
return __DIR__ . '/stubs/dummy.stub';
return __DIR__.'/stubs/dummy.stub';
}

/**
Expand All @@ -72,7 +72,7 @@ protected function getStub()
*/
protected function resolveDirectory()
{
return $this->getDirInput() . 'src';
return $this->getDirInput().'src';
}

/**
Expand All @@ -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())));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Traits/CreatesPackageStubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand All @@ -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(), '/');
}

/**
Expand Down Expand Up @@ -78,7 +78,7 @@ protected function replacePackageName(&$stub)
*/
protected function rootNamespace()
{
return $this->getNamespaceInput() . '\\';
return $this->getNamespaceInput().'\\';
}

/**
Expand Down Expand Up @@ -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.'/';
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/Feature/ReplaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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)
);

Expand Down

0 comments on commit 834fbdc

Please sign in to comment.