Skip to content

Commit 0114c4d

Browse files
committed
refactor: rename variable names
1 parent 434ebbd commit 0114c4d

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

system/Database/Forge.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,15 @@ public function addField($field)
380380
}
381381

382382
if (is_array($field)) {
383-
foreach ($field as $idx => $f) {
384-
if (is_string($f)) {
385-
$this->addField($f);
383+
foreach ($field as $name => $attributes) {
384+
if (is_string($attributes)) {
385+
$this->addField($attributes);
386386

387387
continue;
388388
}
389389

390-
if (is_array($f)) {
391-
$this->fields = array_merge($this->fields, [$idx => $f]);
390+
if (is_array($attributes)) {
391+
$this->fields = array_merge($this->fields, [$name => $attributes]);
392392
}
393393
}
394394
}
@@ -727,8 +727,8 @@ public function addColumn(string $table, $field): bool
727727
$field = [$field];
728728
}
729729

730-
foreach (array_keys($field) as $k) {
731-
$this->addField([$k => $field[$k]]);
730+
foreach (array_keys($field) as $name) {
731+
$this->addField([$name => $field[$name]]);
732732
}
733733

734734
$sqls = $this->_alterTable('ADD', $this->db->DBPrefix . $table, $this->_processFields());
@@ -783,8 +783,8 @@ public function modifyColumn(string $table, $field): bool
783783
$field = [$field];
784784
}
785785

786-
foreach (array_keys($field) as $k) {
787-
$this->addField([$k => $field[$k]]);
786+
foreach (array_keys($field) as $name) {
787+
$this->addField([$name => $field[$name]]);
788788
}
789789

790790
if ($this->fields === []) {
@@ -852,7 +852,7 @@ protected function _processFields(bool $createTable = false): array
852852
{
853853
$fields = [];
854854

855-
foreach ($this->fields as $key => $attributes) {
855+
foreach ($this->fields as $name => $attributes) {
856856
if (! is_array($attributes)) {
857857
$fields[] = ['_literal' => $attributes];
858858

@@ -870,7 +870,7 @@ protected function _processFields(bool $createTable = false): array
870870
}
871871

872872
$field = [
873-
'name' => $key,
873+
'name' => $name,
874874
'new_name' => $attributes['NAME'] ?? null,
875875
'type' => $attributes['TYPE'] ?? null,
876876
'length' => '',
@@ -1163,10 +1163,10 @@ protected function _processForeignKeys(string $table, bool $asQuery = false): ar
11631163
{
11641164
$errorNames = [];
11651165

1166-
foreach ($this->foreignKeys as $name) {
1167-
foreach ($name['field'] as $f) {
1168-
if (! isset($this->fields[$f])) {
1169-
$errorNames[] = $f;
1166+
foreach ($this->foreignKeys as $fkeyInfo) {
1167+
foreach ($fkeyInfo['field'] as $fieldName) {
1168+
if (! isset($this->fields[$fieldName])) {
1169+
$errorNames[] = $fieldName;
11701170
}
11711171
}
11721172
}

0 commit comments

Comments
 (0)