src/core/framework/core/3rdparty/ezcomponents/Database/src/factory.php
static public function create( $dbParams )
    {
        if ( is_string( $dbParams ) )
        {
            $dbParams = self::parseDSN( $dbParams );
        }
        else if ( !is_array( $dbParams ) )
        {
            throw new ezcBaseValueException( 'dbParams', $dbParams, 'string or array', 'parameter' );
        }

        $impName = null; // implementation name

        foreach ( $dbParams as $key => $val )
        {
            if ( in_array( $key, array( 'phptype', 'type', 'handler', 'driver' ) ) )
            {
                 $impName = $val;
                 break;
            }
        }

        if ( $impName === null || !array_key_exists( $impName, self::$implementations ) )
        {
            throw new ezcDbHandlerNotFoundException( $impName, array_keys( self::$implementations ) );
        }

        $className = self::$implementations[$impName];
        $instance = new $className( $dbParams );

        return $instance;
    }
static public function create( $dbParams )
    {
        if ( is_string( $dbParams ) )
        {
            $dbParams = self::parseDSN( $dbParams );
        }
        else if ( !is_array( $dbParams ) )
        {
            throw new ezcBaseValueException( 'dbParams', $dbParams, 'string or array', 'parameter' );
        }

        $impName = null; // implementation name

        foreach ( $dbParams as $key => $val )
        {
            if ( in_array( $key, array( 'phptype', 'type', 'handler', 'driver' ) ) )
            {
                 $impName = $val;
                 break;
            }
        }

        if ( $impName === null || !array_key_exists( $impName, self::$implementations ) )
        {
            throw new ezcDbHandlerNotFoundException( $impName, array_keys( self::$implementations ) );
        }

        $className = self::$implementations[$impName];
        $instance = new $className( $dbParams );

        return $instance;
    }
static public function create ( $ dbParams ) { if ( is_string ( $ dbParams ) ) { $ dbParams = self :: parseDSN ( $ dbParams ) ; } else if ( ! is_array ( $ dbParams ) ) { throw new ezcBaseValueException ( 'dbParams' , $ dbParams , 'string or array' , 'parameter' ) ; } $ impName = null ; // implementation name foreach ( $ dbParams as $ key => $ val ) { if ( in_array ( $ key , array ( 'phptype' , 'type' , 'handler' , 'driver' ) ) ) { $ impName = $ val ; break ; } } if ( $ impName === null || ! array_key_exists ( $ impName , self :: $ implementations ) ) { throw new ezcDbHandlerNotFoundException ( $ impName , array_keys ( self :: $ implementations ) ) ; } $ className = self :: $ implementations [ $ impName ] ; $ instance = new $ className ( $ dbParams ) ; return $ instance ; }
Creates and returns an instance of the specified ezcDbHandler implementation.

Supported database parameters are:
- phptype|type|handler|driver: Database implementation
- user|username:               Database user name
- pass|password:               Database user password
- dbname|database:             Database name
- host|hostspec:               Name of the host database is running on
- port:                        TCP port
- charset:                     Client character set
- socket:                      UNIX socket path

The list above is actually driver-dependent and may be extended in the future.
You can specify any parameters your database handler supports.

@throws ezcDbHandlerNotFoundException if the requested database handler could not be found.
@param   mixed  $dbParams Database parameters
(driver, host, port, user, pass, etc).
May be specified either as array (key => val ....) or as DSN string.
Format of the DSN is the same as accepted by PEAR::DB::parseDSN().
@return ezcDbHandler
Creates and returns an instance of the specified ezcDbHandler implementation .