aboutsummaryrefslogtreecommitdiff
path: root/private/model
diff options
context:
space:
mode:
Diffstat (limited to 'private/model')
-rw-r--r--private/model/Connection.php41
1 files changed, 0 insertions, 41 deletions
diff --git a/private/model/Connection.php b/private/model/Connection.php
deleted file mode 100644
index 42cba28..0000000
--- a/private/model/Connection.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace AugustOffensive\model;
-
-/**
- * Model connection class for connecting to database via PDO.
- */
-class Connection
-{
- /** @var \PDO $_conn PDO connection to database. */
- private $_conn;
- /**
- * Initiates connection to PostGreSQL database.
- *
- * @return Connection
- */
- public function __construct ()
- {
- // Establish connection to db
- include 'creds.php';
-
- try {
- $_conn = new \PDO(
- "pgsql: host=" . $cred->host .
- (($cred->port !== '') ? ";port=" . $cred->port : '') .
- ";dbname=" . $cred->dbName,
- $cred->login,
- $cred->password
- );
- // we destroy $cred as quickly as possible
- $cred = null;
- } catch (\PDOException $e) {
- // we destroy $cred as quickly as possible
- $cred = null;
- die(json_encode(array("Result-Type" => "Error", "Content" => array($e->getMessage()))));
- }
- return $this;
- }
-}