Shikiryu_Backup/app/code/backup/Factory.php

20 lines
384 B
PHP
Raw Normal View History

2015-07-10 19:07:14 +02:00
<?php
namespace Shikiryu\Backup\Backup;
class Factory
{
/**
* @param array $config
2015-07-10 23:13:46 +02:00
*
2015-07-10 19:07:14 +02:00
* @return BackupAbstract
*/
public static function build(array $config)
{
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(array_values($config)[0]);
2015-07-10 19:07:14 +02:00
}
return null;
}
}