Skip to content

Commit c315ff3

Browse files
authored
Merge pull request #37 from Lomkit/fix/path-option-always-true
🐛 has option is true on commands path
2 parents d67f3d3 + ae2b458 commit c315ff3

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

src/Console/Commands/ActionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function getStub()
5252

5353
protected function getPath($name)
5454
{
55-
if ($this->hasOption('path')) {
55+
if (!is_null($this->option('path'))) {
5656
return $this->option('path').'/'.$this->argument('name').'.php';
5757
}
5858

src/Console/Commands/BaseControllerCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function getStub()
6464

6565
protected function getPath($name)
6666
{
67-
if ($this->hasOption('path')) {
67+
if (!is_null($this->option('path'))) {
6868
return $this->option('path').'/'.$this->argument('name').'.php';
6969
}
7070

src/Console/Commands/BaseResourceCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function getStub()
5454

5555
protected function getPath($name)
5656
{
57-
if ($this->hasOption('path')) {
57+
if (!is_null($this->option('path'))) {
5858
return $this->option('path').'/'.$this->argument('name').'.php';
5959
}
6060

src/Console/Commands/ControllerCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function handle()
4141
{
4242
parent::handle();
4343

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

9292
protected function getPath($name)
9393
{
94-
if ($this->hasOption('path')) {
94+
if (!is_null($this->option('path'))) {
9595
return $this->option('path').'/'.$this->argument('name').'.php';
9696
}
9797

src/Console/Commands/DocumentationCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function handle()
5656
protected function getPath($name)
5757
{
5858

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

6262
protected function getStub()

src/Console/Commands/InstructionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function getStub()
6363

6464
protected function getPath($name)
6565
{
66-
if ($this->hasOption('path')) {
66+
if (!is_null($this->option('path'))) {
6767
return $this->option('path').'/'.$this->argument('name').'.php';
6868
}
6969

src/Console/Commands/ResourceCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function handle()
4040
{
4141
parent::handle();
4242

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

5050
protected function getPath($name)
5151
{
52-
if ($this->hasOption('path')) {
52+
if (!is_null($this->option('path'))) {
5353
return $this->option('path').'/'.$this->argument('name').'.php';
5454
}
5555

src/Console/Commands/ResponseCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function getStub()
6767

6868
protected function getPath($name)
6969
{
70-
if ($this->hasOption('path')) {
70+
if (!is_null($this->option('path'))) {
7171
return $this->option('path').'/'.$this->argument('name').'.php';
7272
}
7373

0 commit comments

Comments
 (0)