Skip to content

Commit de36c45

Browse files
author
Mingeun Kim
committed
refactor: constant stub path
1 parent bcfb46d commit de36c45

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/MakeService.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
*/
1212
class MakeService extends GeneratorCommand
1313
{
14+
/**
15+
* STUB_PATH
16+
*/
17+
const STUB_PATH = __DIR__ . ' /Stubs/';
18+
1419
/**
1520
* The name and signature of the console command.
1621
*
@@ -40,19 +45,16 @@ protected function getStub() { }
4045
*/
4146
protected function getServiceStub(bool $isContract): string
4247
{
43-
if ($isContract) {
44-
return __DIR__ . '/Stubs/service.stub';
45-
}
46-
47-
return __DIR__ . '/Stubs/service.origin.stub';
48+
return self::STUB_PATH .
49+
$isContract ? 'service.origin.stub' : 'service.stub';
4850
}
4951

5052
/**
5153
* @return string
5254
*/
5355
protected function getServiceContractStub(): string
5456
{
55-
return __DIR__ . '/Stubs/service.contract.stub';
57+
return self::STUB_PATH . 'service.contract.stub';
5658
}
5759

5860
/**
@@ -95,7 +97,7 @@ public function handle()
9597
if ($isContract) {
9698
$contractName = $this->getNameInput() . 'Contract.php';
9799
$contractPath = str_replace($this->getNameInput() . '.php', 'Contracts/', $path);
98-
100+
99101
$this->makeDirectory($contractPath . $contractName);
100102

101103
$this->files->put($contractPath . $contractName,

0 commit comments

Comments
 (0)