Skip to content

Commit a1d6339

Browse files
refactor(Commands): improvement code style in MakeEnum.php
1 parent 028107b commit a1d6339

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Commands/MakeEnum.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
use Eghamat24\DatabaseRepository\Creators\BaseCreator;
77
use Eghamat24\DatabaseRepository\Creators\CreatorEnum;
88
use Eghamat24\DatabaseRepository\CustomMySqlQueries;
9-
use Illuminate\Console\Command;
109

1110
class MakeEnum extends BaseCommand
1211
{
12+
use CustomMySqlQueries;
13+
1314
/**
1415
* The name and signature of the console command.
1516
*
@@ -27,8 +28,6 @@ class MakeEnum extends BaseCommand
2728
*/
2829
protected $description = 'Create a new enum(s).';
2930

30-
use CustomMySqlQueries;
31-
3231
public function handle(): void
3332
{
3433
$this->setArguments();
@@ -39,10 +38,10 @@ public function handle(): void
3938
$enums = [];
4039
foreach ($columns as $_column) {
4140
if ($_column->DATA_TYPE == 'enum') {
42-
$enumClassName = Str::studly(Str::singular(ucfirst(Str::camel($_column->TABLE_NAME))) . '_' . $_column->COLUMN_NAME) . "Enum";
41+
$enumClassName = Str::studly(Str::singular(ucfirst(Str::camel($_column->TABLE_NAME))) . '_' . $_column->COLUMN_NAME) . 'Enum';
4342
$enums[$enumClassName] = array_filter(explode(',', str_replace(['enum(', '\'', ')'], ['', '', ''], $_column->COLUMN_TYPE)));
4443
$filenameWithPath = $this->relativeEnumsPath . $enumClassName . '.php';
45-
$this->checkDelete($filenameWithPath, $enumClassName, "Enum");
44+
$this->checkDelete($filenameWithPath, $enumClassName, 'Enum');
4645
}
4746
}
4847

@@ -52,7 +51,7 @@ public function handle(): void
5251
$filenameWithPath = $this->relativeEnumsPath . $enumName . '.php';
5352

5453
$this->checkDirectory($this->enumNamespace);
55-
$this->checkClassExist($this->relativeEnumsPath, $enumName, "Enum");
54+
$this->checkClassExist($this->relativeEnumsPath, $enumName, 'Enum');
5655

5756
$enumCreator = new CreatorEnum($columns, $attributeStub, $enum, $enumName, $this->enumNamespace);
5857
$creator = new BaseCreator($enumCreator);

0 commit comments

Comments
 (0)