Shikiryu_Backup/app/code/transport/Factory.php

25 lines
517 B
PHP
Raw Permalink Normal View History

2015-07-10 19:07:14 +02:00
<?php
namespace Shikiryu\Backup\Transport;
2015-07-10 23:13:46 +02:00
use Shikiryu\Backup\Backup\BackupAbstract;
2015-07-10 19:07:14 +02:00
class Factory
{
/**
*
2015-07-10 23:13:46 +02:00
* @param BackupAbstract $backup
* @param array $config
*
* @return TransportAbstract|null
2015-07-10 19:07:14 +02:00
*/
2015-07-10 23:13:46 +02:00
public static function build(BackupAbstract $backup, array $config)
2015-07-10 19:07:14 +02:00
{
2015-07-10 23:13:46 +02:00
$class = __NAMESPACE__.'\\'.array_keys($config)[0];
2015-07-10 19:07:14 +02:00
if (class_exists($class)) {
2015-07-10 23:13:46 +02:00
return new $class($backup, array_values($config)[0]);
2015-07-10 19:07:14 +02:00
}
return null;
}
2016-07-03 21:54:35 +02:00
}