src/DB.php
public function getConnection()
    {
        if (!($this->log instanceof Log)) {
            $this->log = new Log('DB');
        }

        // Use cached connection if already connected to server
        if ($this->connection instanceof \PDO) {
            return $this->connection;
        }

        $this->log->report('Connecting to database...');

        try{
            $this->connection = new \PDO($this->generateDSN(), $this->user, $this->password);
            $this->log->report('Connected to database.');
        } catch ( \PDOException $e ){
            $this->log->error('Failed to connect to database, [SQLSTATE] ' . $e->getCode());
        }

        // Check is the connection to server succeed
        if ($this->connection instanceof \PDO) {
            return $this->connection;
        } else {
            // There was an error connecting to the DB server
            return false;
        }
    }
public function getConnection()
    {
        if (!($this->log instanceof Log)) {
            $this->log = new Log('DB');
        }

        // Use cached connection if already connected to server
        if ($this->connection instanceof \PDO) {
            return $this->connection;
        }

        $this->log->report('Connecting to database...');

        try{
            $this->connection = new \PDO($this->generateDSN(), $this->user, $this->password);
            $this->log->report('Connected to database.');
        } catch ( \PDOException $e ){
            $this->log->error('Failed to connect to database, [SQLSTATE] ' . $e->getCode());
        }

        // Check is the connection to server succeed
        if ($this->connection instanceof \PDO) {
            return $this->connection;
        } else {
            // There was an error connecting to the DB server
            return false;
        }
    }
Gets the connecting to the database
Check if the database connection exists if not connects to the database

@return \PDO | bool