@@ -35,15 +35,14 @@ class DoctrineDbalConnection
3535 *
3636 * @param array $parameters Parameters needed to connect to the database
3737 * @throws DatabaseConnectionException
38- * @return void
3938 * @throws QueryErrorException
4039 */
4140 public function connect (array $ parameters = []): void
4241 {
4342 $ configuration = new Configuration ();
4443 if (array_key_exists ('uri ' , $ parameters )) {
4544 $ connectionParameters = [
46- 'url ' => $ parameters ['uri ' ]
45+ 'url ' => $ parameters ['uri ' ],
4746 ];
4847 } else {
4948 $ connectionParameters = [
@@ -52,37 +51,36 @@ public function connect(array $parameters = []): void
5251 'password ' => $ parameters ['password ' ],
5352 'host ' => $ parameters ['server ' ],
5453 'driver ' => $ parameters ['driver ' ] ?? null ,
55- 'driverClass ' => $ parameters ['driverClass ' ] ?? null
54+ 'driverClass ' => $ parameters ['driverClass ' ] ?? null ,
5655 ];
5756 }
5857 try {
5958 $ this ->connection = DriverManager::getConnection (
60- $ connectionParameters ,
61- $ configuration
59+ $ connectionParameters ,
60+ $ configuration
6261 );
6362 } catch (\Exception $ e ) {
6463 // Throw unified exception
6564 throw new DatabaseConnectionException (
66- sprintf (
67- 'Database connection failed (%s) ' ,
68- $ e ->getMessage ()
69- ),
70- 1491062456
65+ sprintf (
66+ 'Database connection failed (%s) ' ,
67+ $ e ->getMessage ()
68+ ),
69+ 1491062456
7170 );
7271 }
7372
7473 // Execute connection initialization if defined
7574 if (!empty ($ parameters ['init ' ])) {
7675 try {
7776 $ this ->connection ->executeQuery ($ parameters ['init ' ]);
78- }
79- catch (\Throwable $ e ) {
77+ } catch (\Throwable $ e ) {
8078 throw new QueryErrorException (
81- sprintf (
82- 'Failled executing "init" statement (%s) ' ,
83- $ e ->getMessage ()
84- ),
85- 1491379532
79+ sprintf (
80+ 'Failled executing "init" statement (%s) ' ,
81+ $ e ->getMessage ()
82+ ),
83+ 1491379532
8684 );
8785 }
8886 }
@@ -101,14 +99,13 @@ public function query(string $sql, int $fetchMode = \PDO::FETCH_ASSOC): array
10199 {
102100 try {
103101 $ result = $ this ->connection ->executeQuery ($ sql );
104- }
105- catch (\Exception $ e ) {
102+ } catch (\Exception $ e ) {
106103 throw new QueryErrorException (
107- sprintf (
108- 'Failled executing query (%s) ' ,
109- $ e ->getMessage ()
110- ),
111- 1491379701
104+ sprintf (
105+ 'Failled executing query (%s) ' ,
106+ $ e ->getMessage ()
107+ ),
108+ 1491379701
112109 );
113110 }
114111
@@ -118,4 +115,4 @@ public function query(string $sql, int $fetchMode = \PDO::FETCH_ASSOC): array
118115 default => $ result ->fetchAllAssociative (),
119116 };
120117 }
121- }
118+ }
0 commit comments