style:代码中的else if改为elseif

This commit is contained in:
妙码生花 2022-05-05 13:44:23 +08:00
parent 80dcba5344
commit 81138cdb79
6 changed files with 18 additions and 18 deletions

View File

@ -723,9 +723,9 @@ class Crud extends Command
$formFieldList[$field][':data'] = [
'content' => $columnData,
];
} else if ($inputType == 'textarea') {
} elseif ($inputType == 'textarea') {
$formFieldList[$field][':input-attr']['rows'] = 3;
} else if ($inputType == 'remoteSelect' || $inputType == 'remoteSelects') {
} elseif ($inputType == 'remoteSelect' || $inputType == 'remoteSelects') {
$formFieldList[$field][':input-attr']['field'] = $this->getRemoteSelectField($field);
$remoteUrl = $this->getRemoteSelectUrl($field, $relations, $webControllerUrls);
$formFieldList[$field][':input-attr']['remote-url'] = $remoteUrl['url'];
@ -738,17 +738,17 @@ class Crud extends Command
$formFieldList[$field]['type'] = 'remoteSelect';
$formFieldList[$field][':input-attr']['multiple'] = 'true';
}
} else if ($inputType == 'number') {
} elseif ($inputType == 'number') {
$formFieldList[$field]['v-model.number'] = $formFieldList[$field]['v-model'];
unset($formFieldList[$field]['v-model']);
$formFieldList[$field][':input-attr']['step'] = $column['NUMERIC_SCALE'] > 0 ? '0.' . str_repeat(0, $column['NUMERIC_SCALE'] - 1) . '1' : 1;
} else if ($inputType == 'icon') {
} elseif ($inputType == 'icon') {
$formFieldList[$field][':input-attr']['placement'] = 'top';
} else if ($inputType == 'array') {
} elseif ($inputType == 'array') {
$modelFieldType[$field] = 'json';
} else if ($inputType == 'datetime' && $column['DATA_TYPE'] == 'int') {
} elseif ($inputType == 'datetime' && $column['DATA_TYPE'] == 'int') {
$modelFieldType[$field] = 'timestamp:Y-m-d H:i:s';
} else if ($inputType == 'editor') {
} elseif ($inputType == 'editor') {
$formDialogBig = true; // form 使用较宽的 Dialog
// 重写edit方法
@ -1035,7 +1035,7 @@ class Crud extends Command
foreach ($value as $item) {
if (stripos($item, ',') !== false) {
$valueTmp = array_merge($valueTmp, explode(',', $item));
} else if (stripos($item, '') !== false) {
} elseif (stripos($item, '') !== false) {
$valueTmp = array_merge($valueTmp, explode('', $item));
} else {
$valueTmp[] = $item;

View File

@ -124,7 +124,7 @@ class Stub
} else {
if ($item === 'false') {
$itemJson = ' ' . $key . ': false,';
} else if (in_array($key, ['label', 'width', 'buttons']) || strpos($item, "t('") === 0 || strpos($item, "t(\"") === 0) {
} elseif (in_array($key, ['label', 'width', 'buttons']) || strpos($item, "t('") === 0 || strpos($item, "t(\"") === 0) {
$itemJson = ' ' . $key . ': ' . $item . ',';
} else {
$itemJson = ' ' . $key . ': \'' . $item . '\',';
@ -188,11 +188,11 @@ class Stub
$keyStr = strpos($key, "-") === false ? ' ' . $key . ': ' : ' \'' . $key . '\': ';
if (is_array($item)) {
$jsonStr .= $keyStr . self::getJsonFromArray($item) . ',';
} else if ($item === 'false' || $item === 'true') {
} elseif ($item === 'false' || $item === 'true') {
$jsonStr .= $keyStr . ($item === 'false' ? 'false' : 'true') . ',';
} else if (strpos($item, "t('") === 0 || strpos($item, "t(\"") === 0) {
} elseif (strpos($item, "t('") === 0 || strpos($item, "t(\"") === 0) {
$jsonStr .= $keyStr . $item . ',';
} else if (($key == 'remote-url' && strpos($item, "+") !== false) || $key == 'rows') {
} elseif (($key == 'remote-url' && strpos($item, "+") !== false) || $key == 'rows') {
$jsonStr .= $keyStr . $item . ',';
} else {
$jsonStr .= $keyStr . '\'' . $item . '\',';

View File

@ -49,7 +49,7 @@ class Config extends Model
if (in_array($row['type'], $this->jsonDecodeType)) {
$arr = json_decode($value, true);
return $arr ? $arr : [];
} else if ($row['type'] == 'switch') {
} elseif ($row['type'] == 'switch') {
return (bool)$value;
} else {
return $value ? $value : '';
@ -60,7 +60,7 @@ class Config extends Model
{
if (in_array($row['type'], $this->jsonDecodeType)) {
return $value ? json_encode($value) : '';
} else if ($row['type'] == 'switch') {
} elseif ($row['type'] == 'switch') {
return $value ? '1' : '0';
}

View File

@ -66,7 +66,7 @@ class Mysql extends Driver
//返回剩余有效时间
$data['expires_in'] = $this->getExpiredIn($data['expiretime']);
return $data;
} else if ($data['type'] == 'admin-refresh' || $data['type'] == 'user-refresh') {
} elseif ($data['type'] == 'admin-refresh' || $data['type'] == 'user-refresh') {
return $data;
} else {
// token过期-触发前端刷新token

View File

@ -145,7 +145,7 @@ class CommandExec
if (strpos(strtolower($output), 'all packages installed') !== false) {
$this->output($this->CurrentCommandKey . '-success', false);
}
} else if ($this->CurrentCommandKey == 'install-cnpm') {
} elseif ($this->CurrentCommandKey == 'install-cnpm') {
$preg = "/added ([0-9]*) packages in/i";
$preg2 = "/added ([0-9]*) packages, removed/i";
if (preg_match($preg, $output)) {
@ -154,7 +154,7 @@ class CommandExec
if (preg_match($preg2, $output)) {
$this->output('install-cnpm-success', false);
}
} else if ($this->CurrentCommandKey == 'web-build') {
} elseif ($this->CurrentCommandKey == 'web-build') {
if (strpos(strtolower($output), 'build successfully!') !== false) {
$this->output($this->CurrentCommandKey . '-success', false);
}

View File

@ -55,7 +55,7 @@ class Tree
$prefix = ($number == $total) ? self::$icon[2] : self::$icon[1];
if ($level == 2) {
$arr[$key][$field] = str_pad('', 4, ' ') . $prefix . $item[$field];
} else if ($level >= 3) {
} elseif ($level >= 3) {
$arr[$key][$field] = str_pad('', 4, ' ') . ($superiorEnd ? '' : self::$icon[0]) . str_pad('', ($level - 2) * 4, ' ') . $prefix . $item[$field];
}