private function connect()
    {
        $dsn = "{$this->credentials->getDriver()}:host={$this->credentials->getHost()}";

        try {
            $pdo = new \PDO($dsn, $this->credentials->getUsername(), $this->credentials->getPassword());
        } catch (\PDOException $e) {
            throw new \RuntimeException('Failed to connect to database.', 0, $e);
        }

        $this->pdo = $pdo;

        if (null !== $this->credentials->getCharset()) {
            $this->setCharset($this->credentials->getCharset());
        }

        if (null !== $this->credentials->getDatabase()) {
            $this->selectDatabase($this->credentials->getDatabase());
        }
    }
private function connect()
    {
        $dsn = "{$this->credentials->getDriver()}:host={$this->credentials->getHost()}";

        try {
            $pdo = new \PDO($dsn, $this->credentials->getUsername(), $this->credentials->getPassword());
        } catch (\PDOException $e) {
            throw new \RuntimeException('Failed to connect to database.', 0, $e);
        }

        $this->pdo = $pdo;

        if (null !== $this->credentials->getCharset()) {
            $this->setCharset($this->credentials->getCharset());
        }

        if (null !== $this->credentials->getDatabase()) {
            $this->selectDatabase($this->credentials->getDatabase());
        }
    }
private function connect ( ) { $ dsn = "{$this->credentials->getDriver()}:host={$this->credentials->getHost()}" ; try { $ pdo = new \ PDO ( $ dsn , $ this -> credentials -> getUsername ( ) , $ this -> credentials -> getPassword ( ) ) ; } catch ( \ PDOException $ e ) { throw new \ RuntimeException ( 'Failed to connect to database.' , 0 , $ e ) ; } $ this -> pdo = $ pdo ; if ( null !== $ this -> credentials -> getCharset ( ) ) { $ this -> setCharset ( $ this -> credentials -> getCharset ( ) ) ; } if ( null !== $ this -> credentials -> getDatabase ( ) ) { $ this -> selectDatabase ( $ this -> credentials -> getDatabase ( ) ) ; } }
Attempts to connect to database.

@return void
@throws \RuntimeException
Attempts to connect to database .