WIP on PHP (Leaf) version
This commit is contained in:
31
src/app/documents/Configuration.php
Normal file
31
src/app/documents/Configuration.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BitBadger\PgSQL\Documents;
|
||||
|
||||
/**
|
||||
* Document table configuration
|
||||
*/
|
||||
class Configuration
|
||||
{
|
||||
/** @var string $connectionString The connection string to use when establishing a database connection */
|
||||
public static string $connectionString = "";
|
||||
|
||||
/** @var ?\PDO $conn The active connection */
|
||||
private static ?\PDO $conn = null;
|
||||
|
||||
/**
|
||||
* Get the database connection, connecting on first request
|
||||
*
|
||||
* @return PDO The PDO object representing the connection
|
||||
*/
|
||||
public static function getConn(): \PDO
|
||||
{
|
||||
if (is_null(Configuration::$conn)) {
|
||||
Configuration::$conn = new \PDO(Configuration::$connectionString);
|
||||
}
|
||||
return Configuration::$conn;
|
||||
}
|
||||
}
|
||||
|
||||
require('functions.php');
|
||||
Reference in New Issue
Block a user