Skip to content

Commit 35dd6aa

Browse files
style: Apply fixes from StyleCI (#806)
1 parent 213a9d9 commit 35dd6aa

9 files changed

+43
-22
lines changed

src/Commands/BaseCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public function generateCommonItems()
7474
}
7575

7676
if ($this->commandData->getOption('factory') || (
77-
!$this->isSkip('tests') and $this->commandData->getAddOn('tests')
78-
)) {
77+
!$this->isSkip('tests') and $this->commandData->getAddOn('tests')
78+
)) {
7979
$factoryGenerator = new FactoryGenerator($this->commandData);
8080
$factoryGenerator->generate();
8181
}

src/Commands/Publish/LayoutPublishCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,14 @@ private function fillTemplate($templateData)
161161
{
162162
$templateData = str_replace(
163163
'$NAMESPACE_CONTROLLER$',
164-
config('infyom.laravel_generator.namespace.controller'), $templateData
164+
config('infyom.laravel_generator.namespace.controller'),
165+
$templateData
165166
);
166167

167168
$templateData = str_replace(
168169
'$NAMESPACE_REQUEST$',
169-
config('infyom.laravel_generator.namespace.request'), $templateData
170+
config('infyom.laravel_generator.namespace.request'),
171+
$templateData
170172
);
171173

172174
return $templateData;

src/Common/GeneratorConfig.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,13 @@ public function loadPaths()
219219
$this->pathSeeder = config('infyom.laravel_generator.path.seeder', database_path('seeds/'));
220220
$this->pathDatabaseSeeder = config('infyom.laravel_generator.path.database_seeder', database_path('seeds/DatabaseSeeder.php'));
221221
$this->pathViewProvider = config(
222-
'infyom.laravel_generator.path.view_provider', app_path('Providers/ViewServiceProvider.php')
222+
'infyom.laravel_generator.path.view_provider',
223+
app_path('Providers/ViewServiceProvider.php')
223224
);
224225

225226
$this->modelJsPath = config(
226-
'infyom.laravel_generator.path.modelsJs',
227-
resource_path('assets/js/models/')
227+
'infyom.laravel_generator.path.modelsJs',
228+
resource_path('assets/js/models/')
228229
);
229230
}
230231

src/Generators/FactoryGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
*/
1212
class FactoryGenerator extends BaseGenerator
1313
{
14-
/** @var CommandData $commandData */
14+
/** @var CommandData */
1515
private $commandData;
16-
/** @var string $path */
16+
/** @var string */
1717
private $path;
18-
/** @var string $fileName */
18+
/** @var string */
1919
private $fileName;
2020

2121
/**

src/Generators/ModelGenerator.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,15 @@ private function fillSoftDeletes($templateData)
104104
$templateData = str_replace('$SOFT_DELETE_DATES$', '', $templateData);
105105
} else {
106106
$templateData = str_replace(
107-
'$SOFT_DELETE_IMPORT$', "use Illuminate\\Database\\Eloquent\\SoftDeletes;\n",
107+
'$SOFT_DELETE_IMPORT$',
108+
"use Illuminate\\Database\\Eloquent\\SoftDeletes;\n",
108109
$templateData
109110
);
110111
$templateData = str_replace('$SOFT_DELETE$', infy_tab()."use SoftDeletes;\n", $templateData);
111112
$deletedAtTimestamp = config('infyom.laravel_generator.timestamps.deleted_at', 'deleted_at');
112113
$templateData = str_replace(
113-
'$SOFT_DELETE_DATES$', infy_nl_tab()."protected \$dates = ['".$deletedAtTimestamp."'];\n",
114+
'$SOFT_DELETE_DATES$',
115+
infy_nl_tab()."protected \$dates = ['".$deletedAtTimestamp."'];\n",
114116
$templateData
115117
);
116118
}
@@ -200,8 +202,11 @@ public function generateSwagger($templateData)
200202

201203
$template = fill_template($this->commandData->dynamicVars, $template);
202204

203-
$template = str_replace('$REQUIRED_FIELDS$',
204-
'"'.implode('"'.', '.'"', $this->generateRequiredFields()).'"', $template);
205+
$template = str_replace(
206+
'$REQUIRED_FIELDS$',
207+
'"'.implode('"'.', '.'"', $this->generateRequiredFields()).'"',
208+
$template
209+
);
205210

206211
$propertyTemplate = get_template('model_docs.property', 'swagger-generator');
207212

src/Generators/Scaffold/ControllerGenerator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ public function rollback()
146146
}
147147

148148
if ($this->commandData->getAddOn('datatables')) {
149-
if ($this->rollbackFile($this->commandData->config->pathDataTables,
150-
$this->commandData->modelName.'DataTable.php')) {
149+
if ($this->rollbackFile(
150+
$this->commandData->config->pathDataTables,
151+
$this->commandData->modelName.'DataTable.php'
152+
)) {
151153
$this->commandData->commandComment('DataTable file deleted: '.$this->fileName);
152154
}
153155
}

src/Generators/Scaffold/MenuGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public function __construct(CommandData $commandData)
2828
$this->commandData = $commandData;
2929
$this->path = config(
3030
'infyom.laravel_generator.path.views',
31-
resource_path('views/'
31+
resource_path(
32+
'views/'
3233
)
3334
).$commandData->getAddOn('menu.menu_file');
3435
$this->templateType = config('infyom.laravel_generator.templates', 'adminlte-templates');

src/Generators/Scaffold/ViewGenerator.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,11 @@ private function generateShowFields()
364364
if (!$field->inView) {
365365
continue;
366366
}
367-
$singleFieldStr = str_replace('$FIELD_NAME_TITLE$', Str::title(str_replace('_', ' ', $field->name)),
368-
$fieldTemplate);
367+
$singleFieldStr = str_replace(
368+
'$FIELD_NAME_TITLE$',
369+
Str::title(str_replace('_', ' ', $field->name)),
370+
$fieldTemplate
371+
);
369372
$singleFieldStr = str_replace('$FIELD_NAME$', $field->name, $singleFieldStr);
370373
$singleFieldStr = fill_template($this->commandData->dynamicVars, $singleFieldStr);
371374

src/Generators/ViewServiceProviderGenerator.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function addViewVariables($views, $variableName, $columns, $tableName)
5555
$this->commandData->addDynamicVariable('$COMPOSER_VIEWS$', $views);
5656
$this->commandData->addDynamicVariable('$COMPOSER_VIEW_VARIABLE$', $variableName);
5757
$this->commandData->addDynamicVariable(
58-
'$COMPOSER_VIEW_VARIABLE_VALUES$', $model."::pluck($columns)->toArray()"
58+
'$COMPOSER_VIEW_VARIABLE_VALUES$',
59+
$model."::pluck($columns)->toArray()"
5960
);
6061

6162
$mainViewContent = $this->addViewComposer();
@@ -80,7 +81,10 @@ public function addViewComposer()
8081

8182
$replacePosition = strpos($mainViewContent, $lastSeederStatement);
8283
$mainViewContent = substr_replace(
83-
$mainViewContent, $newViewStatement, $replacePosition + strlen($lastSeederStatement) + 6, 0
84+
$mainViewContent,
85+
$newViewStatement,
86+
$replacePosition + strlen($lastSeederStatement) + 6,
87+
0
8488
);
8589

8690
return $mainViewContent;
@@ -116,7 +120,10 @@ public function addNamespace($model, $mainViewContent)
116120
$nameSpaceStatement = $matches[0][$totalMatches - 1];
117121
$replacePosition = strpos($mainViewContent, $nameSpaceStatement);
118122
$mainViewContent = substr_replace(
119-
$mainViewContent, $newModelStatement, $replacePosition + strlen($nameSpaceStatement), 0
123+
$mainViewContent,
124+
$newModelStatement,
125+
$replacePosition + strlen($nameSpaceStatement),
126+
0
120127
);
121128
}
122129

0 commit comments

Comments
 (0)