myPrayerJournal/src/app/documents/Configuration.php

32 lines
751 B
PHP
Raw Normal View History

2023-08-20 17:27:02 -04:00
<?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
{
2023-08-23 22:15:43 -04:00
if (is_null(self::$conn)) {
self::$conn = new \PDO(self::$connectionString);
2023-08-20 17:27:02 -04:00
}
2023-08-23 22:15:43 -04:00
return self::$conn;
2023-08-20 17:27:02 -04:00
}
}
require('functions.php');