Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/Connection.php')
-rw-r--r--src/database/Connection.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/database/Connection.php b/src/database/Connection.php
index f3fedba7..df562d31 100644
--- a/src/database/Connection.php
+++ b/src/database/Connection.php
@@ -6,6 +6,10 @@
namespace PHPPgAdmin\Database;
+use Exception;
+use PHPPgAdmin\Traits\HelperTrait;
+use Slim\Container;
+
/**
* @file
* Class to represent a database connection
@@ -14,7 +18,7 @@ namespace PHPPgAdmin\Database;
*/
class Connection
{
- use \PHPPgAdmin\Traits\HelperTrait;
+ use HelperTrait;
public $conn;
@@ -45,10 +49,10 @@ class Connection
/**
* Creates a new connection. Will actually make a database connection.
*
- * @param array $server_info
- * @param string $database database name
- * @param \Slim\Container $container
- * @param int $fetchMode Defaults to associative. Override for different behaviour
+ * @param array $server_info
+ * @param string $database database name
+ * @param Container $container
+ * @param int $fetchMode Defaults to associative. Override for different behaviour
*/
public function __construct($server_info, $database, $container, $fetchMode = \ADODB_FETCH_ASSOC)
{
@@ -74,7 +78,11 @@ class Connection
$pghost = '';
}
} else {
- $pghost = "{$host}:{$port}";
+ $pghost = \sprintf(
+ '%s:%s',
+ $host,
+ $port
+ );
}
// Add sslmode to $pghost as needed
@@ -87,7 +95,7 @@ class Connection
try {
$this->conn->connect($pghost, $user, $password, $database);
//$this->prtrace($this->conn);
- } catch (\Exception $e) {
+ } catch (Exception $e) {
dump($e);
$this->prtrace($e->getMessage(), $e->getTrace());
}
@@ -140,7 +148,10 @@ class Connection
$version = $params[1]; // eg. 8.4.4
}
- $description = "PostgreSQL {$version}";
+ $description = \sprintf(
+ 'PostgreSQL %s',
+ $version
+ );
$version_parts = \explode('.', $version);