public function driver($driver = '', array $configs = [])
    {
        $driverList = $this->defaultDriverList;
        if (isset($driverList[$driver])) {
            $driver = $driverList[$driver];
            $driver = new $driver($configs);

            if ($driver instanceof DriverInterface) {
                return $driver;
            } else {
                throw new DriverException(sprintf('your %s driver has not Driver Interface', get_class($driver)));
            }
        } else {
            throw new DriverNotInstalledException(sprintf('your %s driver is not installed', $driver));
        }

    }
public function driver($driver = '', array $configs = [])
    {
        $driverList = $this->defaultDriverList;
        if (isset($driverList[$driver])) {
            $driver = $driverList[$driver];
            $driver = new $driver($configs);

            if ($driver instanceof DriverInterface) {
                return $driver;
            } else {
                throw new DriverException(sprintf('your %s driver has not Driver Interface', get_class($driver)));
            }
        } else {
            throw new DriverNotInstalledException(sprintf('your %s driver is not installed', $driver));
        }

    }
public function driver ( $ driver = '' , array $ configs = [ ] ) { $ driverList = $ this -> defaultDriverList ; if ( isset ( $ driverList [ $ driver ] ) ) { $ driver = $ driverList [ $ driver ] ; $ driver = new $ driver ( $ configs ) ; if ( $ driver instanceof DriverInterface ) { return $ driver ; } else { throw new DriverException ( sprintf ( 'your %s driver has not Driver Interface' , get_class ( $ driver ) ) ) ; } } else { throw new DriverNotInstalledException ( sprintf ( 'your %s driver is not installed' , $ driver ) ) ; } }
select a driver

@param string $driver the name of driver
@param array $configs the configs for driver
@throws DriverException
@throws DriverNotInstalledException
@return DriverInterface if driver name isset in driver list, return the driver instance, else return false
select a driver