Skip to content

Commit

Permalink
Merge pull request #37 from Lomkit/fix/path-option-always-true
Browse files Browse the repository at this point in the history
🐛 has option is true on commands path
  • Loading branch information
GautierDele authored Sep 10, 2023
2 parents d67f3d3 + ae2b458 commit c315ff3
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Console/Commands/ActionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function getStub()

protected function getPath($name)
{
if ($this->hasOption('path')) {
if (!is_null($this->option('path'))) {
return $this->option('path').'/'.$this->argument('name').'.php';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/BaseControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function getStub()

protected function getPath($name)
{
if ($this->hasOption('path')) {
if (!is_null($this->option('path'))) {
return $this->option('path').'/'.$this->argument('name').'.php';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/BaseResourceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function getStub()

protected function getPath($name)
{
if ($this->hasOption('path')) {
if (!is_null($this->option('path'))) {
return $this->option('path').'/'.$this->argument('name').'.php';
}

Expand Down
4 changes: 2 additions & 2 deletions src/Console/Commands/ControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function handle()
{
parent::handle();

if (!$this->hasOption('path')) {
if (is_null($this->option('path'))) {
$this->callSilent('rest:base-controller', [
'name' => 'Controller',
]);
Expand Down Expand Up @@ -91,7 +91,7 @@ protected function getStub()

protected function getPath($name)
{
if ($this->hasOption('path')) {
if (!is_null($this->option('path'))) {
return $this->option('path').'/'.$this->argument('name').'.php';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/DocumentationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function handle()
protected function getPath($name)
{

return $this->hasOption('path') ? $this->option('path').'/'.$name.'.json' : public_path('vendor/rest/'.$name.'.json');
return !is_null($this->option('path')) ? $this->option('path').'/'.$name.'.json' : public_path('vendor/rest/'.$name.'.json');
}

protected function getStub()
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/InstructionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected function getStub()

protected function getPath($name)
{
if ($this->hasOption('path')) {
if (!is_null($this->option('path'))) {
return $this->option('path').'/'.$this->argument('name').'.php';
}

Expand Down
4 changes: 2 additions & 2 deletions src/Console/Commands/ResourceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function handle()
{
parent::handle();

if (!$this->hasOption('path')) {
if (is_null($this->option('path'))) {
$this->callSilent('rest:base-resource', [
'name' => 'Resource',
]);
Expand All @@ -49,7 +49,7 @@ public function handle()

protected function getPath($name)
{
if ($this->hasOption('path')) {
if (!is_null($this->option('path'))) {
return $this->option('path').'/'.$this->argument('name').'.php';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/ResponseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function getStub()

protected function getPath($name)
{
if ($this->hasOption('path')) {
if (!is_null($this->option('path'))) {
return $this->option('path').'/'.$this->argument('name').'.php';
}

Expand Down

0 comments on commit c315ff3

Please sign in to comment.