private function getDatabaseInstance($id = null)
    {
        $config = App::getOption('db');
        $Database = 'Josantonius\\Database\\Database';

        if (! class_exists($Database) || ! is_array($config)) {
            return;
        }

        $id = $id ?: array_keys($config)[0];

        $required = ['provider', 'host', 'user', 'name', 'password', 'settings'];

        if (! array_diff($required, array_keys($config[$id]))) {
            $this->db = $Database::getConnection(
                $id,
                $config[$id]['provider'],
                $config[$id]['host'],
                $config[$id]['user'],
                $config[$id]['name'],
                $config[$id]['password'],
                $config[$id]['settings']
            );
        }
    }
private function getDatabaseInstance($id = null)
    {
        $config = App::getOption('db');
        $Database = 'Josantonius\\Database\\Database';

        if (! class_exists($Database) || ! is_array($config)) {
            return;
        }

        $id = $id ?: array_keys($config)[0];

        $required = ['provider', 'host', 'user', 'name', 'password', 'settings'];

        if (! array_diff($required, array_keys($config[$id]))) {
            $this->db = $Database::getConnection(
                $id,
                $config[$id]['provider'],
                $config[$id]['host'],
                $config[$id]['user'],
                $config[$id]['name'],
                $config[$id]['password'],
                $config[$id]['settings']
            );
        }
    }
private function getDatabaseInstance ( $ id = null ) { $ config = App :: getOption ( 'db' ) ; $ Database = 'Josantonius\\Database\\Database' ; if ( ! class_exists ( $ Database ) || ! is_array ( $ config ) ) { return ; } $ id = $ id ? : array_keys ( $ config ) [ 0 ] ; $ required = [ 'provider' , 'host' , 'user' , 'name' , 'password' , 'settings' ] ; if ( ! array_diff ( $ required , array_keys ( $ config [ $ id ] ) ) ) { $ this -> db = $ Database :: getConnection ( $ id , $ config [ $ id ] [ 'provider' ] , $ config [ $ id ] [ 'host' ] , $ config [ $ id ] [ 'user' ] , $ config [ $ id ] [ 'name' ] , $ config [ $ id ] [ 'password' ] , $ config [ $ id ] [ 'settings' ] ) ; } }
Get Database connection.

This method will only be run if the Database class exists.

@since 1.0.6

@uses \Josantonius\Database\Database

@link https://github.com/Josantonius/PHP-Database

@return object → Database instance
Get Database connection .