@@ -157,7 +157,7 @@ |
||
157 | 157 | 'charset' => $this->_charset[$connectionName], |
158 | 158 | 'schema' => $this->_schema[$connectionName] |
159 | 159 | ]; |
160 | - } else { |
|
160 | + }else { |
|
161 | 161 | throw new \Exception("The connection name $connectionName is not set."); |
162 | 162 | } |
163 | 163 |
@@ -78,15 +78,27 @@ discard block |
||
78 | 78 | $defaultSchema = null) |
79 | 79 | { |
80 | 80 | #Begin: Verify if all parameters send is valid. |
81 | - if (!is_string($driver) || !in_array($driver, self::DRIVERS)) throw new \Exception("The driver $driver don't supported."); |
|
82 | - if (!is_string($username) || empty($username)) throw new \Exception("Invalid username."); |
|
83 | - if (!is_string($password) || empty($password)) throw new \Exception("Invalid password."); |
|
84 | - if (!is_string($host) || empty($host)) throw new \Exception("Invalid host."); |
|
85 | - if (!is_string($database) || empty($database)) throw new \Exception("Invalid database name."); |
|
81 | + if (!is_string($driver) || !in_array($driver, self::DRIVERS)) { |
|
82 | + throw new \Exception("The driver $driver don't supported."); |
|
83 | + } |
|
84 | + if (!is_string($username) || empty($username)) { |
|
85 | + throw new \Exception("Invalid username."); |
|
86 | + } |
|
87 | + if (!is_string($password) || empty($password)) { |
|
88 | + throw new \Exception("Invalid password."); |
|
89 | + } |
|
90 | + if (!is_string($host) || empty($host)) { |
|
91 | + throw new \Exception("Invalid host."); |
|
92 | + } |
|
93 | + if (!is_string($database) || empty($database)) { |
|
94 | + throw new \Exception("Invalid database name."); |
|
95 | + } |
|
86 | 96 | $this->validatesConnectionName($connectionName); |
87 | 97 | |
88 | 98 | $port = is_null($port) ? '' : (int)$port; |
89 | - if (!is_null($port) && !is_int($port)) throw new \Exception("Invalid port format."); |
|
99 | + if (!is_null($port) && !is_int($port)) { |
|
100 | + throw new \Exception("Invalid port format."); |
|
101 | + } |
|
90 | 102 | |
91 | 103 | #Constructor of the connection string |
92 | 104 | $this->_connectionString[$connectionName] = $this->renderConnectionString($driver, $host, $database, $port); |
@@ -184,8 +196,12 @@ discard block |
||
184 | 196 | */ |
185 | 197 | public function setSettings($connectionName, $connectionSettings) |
186 | 198 | { |
187 | - if (!is_array($connectionSettings)) throw new \Exception('Invalid format connectionSettings'); |
|
188 | - if (empty($this->_driver[$connectionName])) throw new \Exception('Driver not set.'); |
|
199 | + if (!is_array($connectionSettings)) { |
|
200 | + throw new \Exception('Invalid format connectionSettings'); |
|
201 | + } |
|
202 | + if (empty($this->_driver[$connectionName])) { |
|
203 | + throw new \Exception('Driver not set.'); |
|
204 | + } |
|
189 | 205 | |
190 | 206 | $this->validatesConnectionName($connectionName); |
191 | 207 |