@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Get an instance of the db connection |
| 51 | - * @return SQLite3 connection |
|
| 51 | + * @return null|PDO connection |
|
| 52 | 52 | */ |
| 53 | 53 | public static function db() |
| 54 | 54 | { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | /** |
| 116 | 116 | * Check if PORT is provided in the database config |
| 117 | 117 | * @param array $config database configuration array |
| 118 | - * @return void |
|
| 118 | + * @return string |
|
| 119 | 119 | */ |
| 120 | 120 | private function checkPort($config) |
| 121 | 121 | { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function connectSQLite($config) |
| 79 | 79 | { |
| 80 | 80 | try { |
| 81 | - $db = new PDO("sqlite:".$config['database']); |
|
| 81 | + $db = new PDO("sqlite:" . $config['database']); |
|
| 82 | 82 | } catch (PDOException $e) { |
| 83 | 83 | throw new PotatoException($e->getMessage()); |
| 84 | 84 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $this->checkParam($config); |
| 92 | 92 | |
| 93 | 93 | try { |
| 94 | - $db = new PDO("mssql:host=".$config['host'].";dbname=".$config['database'].", ".$config['user'].", ".$config['password']); |
|
| 94 | + $db = new PDO("mssql:host=" . $config['host'] . ";dbname=" . $config['database'] . ", " . $config['user'] . ", " . $config['password']); |
|
| 95 | 95 | } catch (PDOException $e) { |
| 96 | 96 | throw new PotatoException($e->getMessage()); |
| 97 | 97 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $this->checkParam($config); |
| 105 | 105 | |
| 106 | 106 | try { |
| 107 | - $db = new PDO($config['type'].":host=".$config['host'].$this->checkPort($config).";dbname=".$config['database'], $config['user'], $config['password']); |
|
| 107 | + $db = new PDO($config['type'] . ":host=" . $config['host'] . $this->checkPort($config) . ";dbname=" . $config['database'], $config['user'], $config['password']); |
|
| 108 | 108 | } catch (PDOException $e) { |
| 109 | 109 | throw new PotatoException($e->getMessage()); |
| 110 | 110 | } |
@@ -119,6 +119,6 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function checkPort($config) |
| 121 | 121 | { |
| 122 | - return array_key_exists('port', $config) ? ";port=".$config['port'] : ''; |
|
| 122 | + return array_key_exists('port', $config) ? ";port=" . $config['port'] : ''; |
|
| 123 | 123 | } |
| 124 | 124 | } |