Skip to content

Commit 8f358ed

Browse files
style: Apply fixes from StyleCI (#1026)
Co-authored-by: StyleCI Bot <[email protected]>
1 parent 2a9751c commit 8f358ed

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

src/Common/GeneratorField.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace InfyOm\Generator\Common;
44

5-
use Doctrine\DBAL\Schema\Column;
65
use Illuminate\Support\Str;
76

87
class GeneratorField
@@ -40,15 +39,16 @@ public function parseDBType($dbInput)
4039
if (!Str::contains($dbInput, ':')) {
4140
$this->dbType = $dbInput;
4241
$this->prepareMigrationText();
42+
4343
return;
4444
}
4545

4646
$dbInputArr = explode(':', $dbInput);
47-
$dbType = (string)array_shift($dbInputArr);
47+
$dbType = (string) array_shift($dbInputArr);
4848

4949
if (Str::contains($dbType, ',')) {
5050
$dbTypeArr = explode(',', $dbType);
51-
$this->dbType = (string)array_shift($dbTypeArr);
51+
$this->dbType = (string) array_shift($dbTypeArr);
5252
$this->dbTypeParams = $dbTypeArr;
5353
} else {
5454
$this->dbType = $dbType;
@@ -68,16 +68,18 @@ public function parseHtmlInput($htmlInput)
6868
{
6969
if (empty($htmlInput)) {
7070
$this->htmlType = 'text';
71+
7172
return;
7273
}
7374

7475
if (!Str::contains($htmlInput, ':')) {
7576
$this->htmlType = $htmlInput;
77+
7678
return;
7779
}
7880

7981
$htmlInputArr = explode(':', $htmlInput);
80-
$this->htmlType = (string)array_shift($htmlInputArr);
82+
$this->htmlType = (string) array_shift($htmlInputArr);
8183
$this->htmlValues = explode(',', implode(':', $htmlInputArr));
8284
}
8385

@@ -114,10 +116,11 @@ public function parseOptions($options)
114116
private function prepareMigrationText()
115117
{
116118
$this->migrationText = '$table->';
117-
$this->migrationText .= $this->dbType . "('" . $this->name . "'";
119+
$this->migrationText .= $this->dbType."('".$this->name."'";
118120

119121
if (!count($this->dbTypeParams) and !count($this->dbExtraFunctions)) {
120-
$this->migrationText .= ");";
122+
$this->migrationText .= ');';
123+
121124
return;
122125
}
123126

@@ -131,25 +134,26 @@ private function prepareMigrationText()
131134
// $this->migrationText .= ']';
132135
// }
133136
foreach ($this->dbTypeParams as $dbTypeParam) {
134-
$this->migrationText .= ', ' . $dbTypeParam;
137+
$this->migrationText .= ', '.$dbTypeParam;
135138
}
136139
}
137140

138-
$this->migrationText .= ")";
141+
$this->migrationText .= ')';
139142

140143
if (!count($this->dbExtraFunctions)) {
141-
$this->migrationText .= ";";
144+
$this->migrationText .= ';';
145+
142146
return;
143147
}
144148

145149
$this->foreignKeyText = '';
146150
foreach ($this->dbExtraFunctions as $dbExtraFunction) {
147151
$dbExtraFunctionArr = explode(',', $dbExtraFunction);
148-
$functionName = (string)array_shift($dbExtraFunctionArr);
152+
$functionName = (string) array_shift($dbExtraFunctionArr);
149153
if ($functionName === 'foreign') {
150154
$foreignTable = array_shift($dbExtraFunctionArr);
151155
$foreignField = array_shift($dbExtraFunctionArr);
152-
$this->foreignKeyText .= "\$table->foreign('" . $this->name . "')->references('" . $foreignField . "')->on('" . $foreignTable . "')";
156+
$this->foreignKeyText .= "\$table->foreign('".$this->name."')->references('".$foreignField."')->on('".$foreignTable."')";
153157
if (count($dbExtraFunctionArr)) {
154158
$cascade = array_shift($dbExtraFunctionArr);
155159
if ($cascade === 'cascade') {
@@ -158,7 +162,7 @@ private function prepareMigrationText()
158162
}
159163
$this->foreignKeyText .= ';';
160164
} else {
161-
$this->migrationText .= '->' . $functionName;
165+
$this->migrationText .= '->'.$functionName;
162166
$this->migrationText .= '(';
163167
$this->migrationText .= implode(', ', $dbExtraFunctionArr);
164168
$this->migrationText .= ')';
@@ -234,7 +238,7 @@ public function getTitle()
234238
public function variables()
235239
{
236240
return [
237-
'fieldName' => $this->name,
241+
'fieldName' => $this->name,
238242
'fieldTitle' => $this->getTitle(),
239243
];
240244
}

src/Utils/TableFieldsGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private function generateField($column, $dbType, $htmlType)
257257
{
258258
$field = new GeneratorField();
259259
$field->name = $column->getName();
260-
$field->parseDBType($dbType);//, $column); TODO: handle column param
260+
$field->parseDBType($dbType); //, $column); TODO: handle column param
261261
$field->parseHtmlInput($htmlType);
262262

263263
return $this->checkForPrimary($field);

0 commit comments

Comments
 (0)