src/Pckg/Database/Repository/RepositoryFactory.php
protected static function getRepositoryByConfig($config, $name)
    {
        if (!is_array($config)) {
            if (class_exists($config)) {
                return new $config;
            }

            throw new Exception('Cannot create repository from string');
        } elseif ($config['driver'] == 'faker') {
            return new Faker(Factory::create());
        } elseif ($config['driver'] == 'middleware') {
            return resolve($config['middleware'])->execute(function() {
            }
            );
        }

        return static::initPdoDatabase($config, $name);
    }
protected static function getRepositoryByConfig($config, $name)
    {
        if (!is_array($config)) {
            if (class_exists($config)) {
                return new $config;
            }

            throw new Exception('Cannot create repository from string');
        } elseif ($config['driver'] == 'faker') {
            return new Faker(Factory::create());
        } elseif ($config['driver'] == 'middleware') {
            return resolve($config['middleware'])->execute(function() {
            }
            );
        }

        return static::initPdoDatabase($config, $name);
    }
protected static function getRepositoryByConfig ( $ config , $ name ) { if ( ! is_array ( $ config ) ) { if ( class_exists ( $ config ) ) { return new $ config ; } throw new Exception ( 'Cannot create repository from string' ) ; } elseif ( $ config [ 'driver' ] == 'faker' ) { return new Faker ( Factory :: create ( ) ) ; } elseif ( $ config [ 'driver' ] == 'middleware' ) { return resolve ( $ config [ 'middleware' ] ) -> execute ( function ( ) { } ) ; } return static :: initPdoDatabase ( $ config , $ name ) ; }
Instantiate connection for defined driver.

@param $config
@param $name

@return Faker|RepositoryPDO
@throws Exception
Instantiate connection for defined driver .