diff --git a/src/Factory/Connection.php b/src/Factory/Connection.php index afc4c19..788762d 100644 --- a/src/Factory/Connection.php +++ b/src/Factory/Connection.php @@ -84,27 +84,25 @@ public function compile(array $config): SQL\Factory\Repository\Connection $repository = new SQL\Factory\Repository\Connection($connection); - if (\array_key_exists('shared', $config) && true === $config['shared']) { - $repository->addFiles(new File('PDOPool.php', new InMemory(<<generatedNamespace}; - final class PDOPool { - private static array \$connections = []; - public static function unique(string \$dsn, ?string \$username = null, ?string \$password = null, \$options = []): \\PDO { - return new \\PDO(\$dsn, \$username, \$password, \$options); - } - public static function shared(string \$dsn, ?string \$username = null, ?string \$password = null, \$options = []): \\PDO { - if (isset(self::\$connections[\$dsn])) { - return self::\$connections[\$dsn]; - } - - return self::\$connections[\$dsn] = self::unique(\$dsn, \$username, \$password, \$options); + $repository->addFiles(new File('PDOPool.php', new InMemory(<<generatedNamespace}; + final class PDOPool { + private static array \$connections = []; + public static function unique(string \$dsn, ?string \$username = null, ?string \$password = null, \$options = []): \\PDO { + return new \\PDO(\$dsn, \$username, \$password, \$options); + } + public static function shared(string \$dsn, ?string \$username = null, ?string \$password = null, \$options = []): \\PDO { + if (isset(self::\$connections[\$dsn])) { + return self::\$connections[\$dsn]; } + + return self::\$connections[\$dsn] = self::unique(\$dsn, \$username, \$password, \$options); } - PHP - ))); - } + } + PHP + ))); return $repository; }