protected function driver($name, $data = array())
    {
        if (in_array($name, $this->mysql) === true) {
            $dsn = (string) 'mysql:host=%s;dbname=%s';

            $dsn = sprintf($dsn, $data['hostname'], $data['database']);

            $pdo = new \PDO($dsn, $data['username'], $data['password']);

            return new MySQLDriver($pdo, (string) $data['database']);
        }

        if (in_array($name, $this->sqlite)) {
            return new SQLiteDriver(new \PDO($data['hostname']));
        }

        $message = 'Database driver "%s" not found.';

        $message = sprintf($message, (string) $name);

        throw new DriverNotFoundException($message);
    }
protected function driver($name, $data = array())
    {
        if (in_array($name, $this->mysql) === true) {
            $dsn = (string) 'mysql:host=%s;dbname=%s';

            $dsn = sprintf($dsn, $data['hostname'], $data['database']);

            $pdo = new \PDO($dsn, $data['username'], $data['password']);

            return new MySQLDriver($pdo, (string) $data['database']);
        }

        if (in_array($name, $this->sqlite)) {
            return new SQLiteDriver(new \PDO($data['hostname']));
        }

        $message = 'Database driver "%s" not found.';

        $message = sprintf($message, (string) $name);

        throw new DriverNotFoundException($message);
    }
protected function driver ( $ name , $ data = array ( ) ) { if ( in_array ( $ name , $ this -> mysql ) === true ) { $ dsn = ( string ) 'mysql:host=%s;dbname=%s' ; $ dsn = sprintf ( $ dsn , $ data [ 'hostname' ] , $ data [ 'database' ] ) ; $ pdo = new \ PDO ( $ dsn , $ data [ 'username' ] , $ data [ 'password' ] ) ; return new MySQLDriver ( $ pdo , ( string ) $ data [ 'database' ] ) ; } if ( in_array ( $ name , $ this -> sqlite ) ) { return new SQLiteDriver ( new \ PDO ( $ data [ 'hostname' ] ) ) ; } $ message = 'Database driver "%s" not found.' ; $ message = sprintf ( $ message , ( string ) $ name ) ; throw new DriverNotFoundException ( $ message ) ; }
Returns the Driver instance from the configuration.

@param  string $name
@param  array  $data
@return \Rougin\Describe\Driver\DriverInterface

@throws \Rougin\Describe\Exceptions\DriverNotFoundException
Returns the Driver instance from the configuration .