<commit_before><?php

/**
 * Class for managing the database connection
 * 
 * @originalauthor <NAME>
 * @link https://www.youtube.com/playlist?list=PLfdtiltiRHWF5Rhuk7k4UAU1yLAZzhWc 
 * Tutorial videos from Alex Garret (Code Course)
 * @author <NAME> <<EMAIL>>
 */

namespace PHP\CRUD;

use PDO;
use PDOException;

class Database
{

    protected static $instance = null;

    private
            $driver,
            $host,
            $database,
            $username,
            $password;

    public
            $pdo,
            $query,
            $error = false,
            $results,
            $first,
            $count = 0,
            $records,
            $perPage,
            $pages;

    public function __construct($connection = array())
    {
        $this->driver     = $connection['driver'];
        $this->host   = $connection['host'];
        $this->database = $connection['database'];
        $this->username     = $connection['username'];
        $this->password = $connection['password'];

        try {
            $this->pdo = new PDO(
                $this->driver . ':host=' . 
                $this->host . ';dbname=' . 
                $this->database, 
                $this->username, 
                $this->password
            );

        $this->pdo->exec('set names ' . $connection['charset']);

        } catch (PDOException $e) {
            die($e->getMessage());
        }
    }

    public static function singleton($connection = array())
    {
        if (!isset(self::$instance)) {
            self::$instance = new Database($connection = array());
        }

        return self::$instance;
    }
<commit_msg>Update Database.php<commit_after><?php

/**
 * Class for managing the database connection
 * 
 * @originalauthor <NAME>
 * @link https://www.youtube.com/playlist?list=PLfdtiltiRHWF5Rhuk7k4UAU1yLAZzhWc 
 * Tutorial videos from Alex Garret (Code Course)
 * @author <NAME> <<EMAIL>>
 */

namespace PHP\CRUD;

use PDO;
use PDOException;

class Database
{

    private static $instance = null;

    private
            $driver,
            $host,
            $database,
            $username,
            $password;

    public
            $pdo,
            $query,
            $error = false,
            $results,
            $first,
            $count = 0,
            $records,
            $perPage,
            $pages;

    public function __construct($connection = array())
    {
        $this->driver     = $connection['driver'];
        $this->host   = $connection['host'];
        $this->database = $connection['database'];
        $this->username     = $connection['username'];
        $this->password = $connection['password'];

        try {
            $this->pdo = new PDO(
                $this->driver . ':host=' . 
                $this->host . ';dbname=' . 
                $this->database, 
                $this->username, 
                $this->password
            );

        $this->pdo->exec('set names ' . $connection['charset']);

        } catch (PDOException $e) {
            die($e->getMessage());
        }
    }

    public static function singleton($connection = array())
    {
        if (!isset(self::$instance)) {
            self::$instance = new Database($connection);
        }

        return self::$instance;
    }

{'fraction_non_alphanumeric': 0.14018126888217522, 'fraction_numerical': 0.0030211480362537764, 'mean_word_length': 1.6424581005586592, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 39, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7010776', 'n_tokens_mistral': 950, 'n_tokens_neox': 909, 'n_words': 192}