src/Cornford/Backup/BackupFactory.php
public function buildBackupEngine(
		array $options = [],
		$database = null
	) {
		$backupProcessInstance = new BackupProcess(new Process(''));

		switch ($database ? $database : $options['default'])
		{
			case 'mysql':
				return new BackupEngineMysql(
					$backupProcessInstance,
					$options['connections'][$options['default']]['database'],
					$options['connections'][$options['default']]['host'],
					isset($options['connections'][$options['default']]['port']) ? $options['connections'][$options['default']]['port'] : 3306,
					$options['connections'][$options['default']]['username'],
					$options['connections'][$options['default']]['password'],
					$options
				);
			case 'pgsql':
				return new BackupEnginePgsql(
					$backupProcessInstance,
					$options['connections'][$options['default']]['database'],
					$options['connections'][$options['default']]['host'],
					null,
					$options['connections'][$options['default']]['username'],
					$options['connections'][$options['default']]['password'],
					$options
				);
			case 'sqlite':
				return new BackupEngineSqlite(
					$backupProcessInstance,
					$options['connections'][$options['default']]['database'],
					null,
					null,
					null,
					null,
					$options
				);
			case 'sqlsrv':
				return new BackupEngineSqlsrv(
					$backupProcessInstance,
					$options['connections'][$options['default']]['database'],
					$options['connections'][$options['default']]['host'],
					null,
					$options['connections'][$options['default']]['username'],
					$options['connections'][$options['default']]['password'],
					$options
				);
			default:
				throw new BackupException('Database driver isn\'t supported.');
		}
	}
public function buildBackupEngine(
		array $options = [],
		$database = null
	) {
		$backupProcessInstance = new BackupProcess(new Process(''));

		switch ($database ? $database : $options['default'])
		{
			case 'mysql':
				return new BackupEngineMysql(
					$backupProcessInstance,
					$options['connections'][$options['default']]['database'],
					$options['connections'][$options['default']]['host'],
					isset($options['connections'][$options['default']]['port']) ? $options['connections'][$options['default']]['port'] : 3306,
					$options['connections'][$options['default']]['username'],
					$options['connections'][$options['default']]['password'],
					$options
				);
			case 'pgsql':
				return new BackupEnginePgsql(
					$backupProcessInstance,
					$options['connections'][$options['default']]['database'],
					$options['connections'][$options['default']]['host'],
					null,
					$options['connections'][$options['default']]['username'],
					$options['connections'][$options['default']]['password'],
					$options
				);
			case 'sqlite':
				return new BackupEngineSqlite(
					$backupProcessInstance,
					$options['connections'][$options['default']]['database'],
					null,
					null,
					null,
					null,
					$options
				);
			case 'sqlsrv':
				return new BackupEngineSqlsrv(
					$backupProcessInstance,
					$options['connections'][$options['default']]['database'],
					$options['connections'][$options['default']]['host'],
					null,
					$options['connections'][$options['default']]['username'],
					$options['connections'][$options['default']]['password'],
					$options
				);
			default:
				throw new BackupException('Database driver isn\'t supported.');
		}
	}
public function buildBackupEngine ( array $ options = [ ] , $ database = null ) { $ backupProcessInstance = new BackupProcess ( new Process ( '' ) ) ; switch ( $ database ? $ database : $ options [ 'default' ] ) { case 'mysql' : return new BackupEngineMysql ( $ backupProcessInstance , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'database' ] , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'host' ] , isset ( $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'port' ] ) ? $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'port' ] : 3306 , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'username' ] , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'password' ] , $ options ) ; case 'pgsql' : return new BackupEnginePgsql ( $ backupProcessInstance , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'database' ] , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'host' ] , null , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'username' ] , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'password' ] , $ options ) ; case 'sqlite' : return new BackupEngineSqlite ( $ backupProcessInstance , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'database' ] , null , null , null , null , $ options ) ; case 'sqlsrv' : return new BackupEngineSqlsrv ( $ backupProcessInstance , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'database' ] , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'host' ] , null , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'username' ] , $ options [ 'connections' ] [ $ options [ 'default' ] ] [ 'password' ] , $ options ) ; default : throw new BackupException ( 'Database driver isn\'t supported.' ) ; } }
Build a new Backup Engine object.

@param array  $options
@param string $database

@throws BackupException

@return \Cornford\Backup\Contracts\BackupEngineInterface
Build a new Backup Engine object .