Skip to content

Commit 5dffe77

Browse files
committed
refactor: add else
1 parent 02b5021 commit 5dffe77

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

system/Database/Config.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ public static function connect($group = null, bool $getShared = true)
5454
if (is_array($group)) {
5555
$config = $group;
5656
$group = 'custom-' . md5(json_encode($config));
57-
}
58-
59-
/** @var DbConfig $dbConfig */
60-
$dbConfig = config('Database');
57+
} else {
58+
/** @var DbConfig $dbConfig */
59+
$dbConfig = config('Database');
6160

62-
if ($group === null) {
63-
$group = (ENVIRONMENT === 'testing') ? 'tests' : $dbConfig->defaultGroup;
64-
}
61+
if ($group === null) {
62+
$group = (ENVIRONMENT === 'testing') ? 'tests' : $dbConfig->defaultGroup;
63+
}
6564

66-
if (is_string($group) && ! isset($dbConfig->{$group}) && strpos($group, 'custom-') !== 0) {
67-
throw new InvalidArgumentException($group . ' is not a valid database connection group.');
65+
if (is_string($group) && ! isset($dbConfig->{$group}) && strpos($group, 'custom-') !== 0) {
66+
throw new InvalidArgumentException($group . ' is not a valid database connection group.');
67+
}
6868
}
6969

7070
if ($getShared && isset(static::$instances[$group])) {

0 commit comments

Comments
 (0)