Skip to content

Commit 99346b4

Browse files
committed
refactor: move if conditions to isValidDSN()
1 parent 5ee0df2 commit 99346b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

system/Database/OCI8/Connection.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ class Connection extends BaseConnection
104104
*/
105105
private function isValidDSN(): bool
106106
{
107+
if ($this->DSN === null || $this->DSN === '') {
108+
return false;
109+
}
110+
107111
foreach ($this->validDSNs as $regexp) {
108112
if (preg_match($regexp, $this->DSN)) {
109113
return true;
@@ -120,7 +124,7 @@ private function isValidDSN(): bool
120124
*/
121125
public function connect(bool $persistent = false)
122126
{
123-
if ($this->DSN === null || $this->DSN === '' || ! $this->isValidDSN()) {
127+
if (! $this->isValidDSN()) {
124128
$this->buildDSN();
125129
}
126130

0 commit comments

Comments
 (0)