mirror of
https://github.com/Chouchen/Shikiryu_Backup.git
synced 2026-09-24 16:03:54 +02:00
Abstraction and factorization
This commit is contained in:
1 parent
88a5b39d23
commit
dbcd02c2af
9 files changed
+208
-86
No files matched your search
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
class Shikiryu_Backup_Transport_Factory
|
||||
{
|
||||
/**
|
||||
* @param $type
|
||||
* @param Shikiryu_Backup_Abstract $backup
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function getAndSend($type, Shikiryu_Backup_Abstract $backup, $args = null) {
|
||||
$class = sprintf('Shikiryu_Backup_Transport_%s', ucfirst($type));
|
||||
if (class_exists($class)) {
|
||||
/* @var $instance Shikiryu_Backup_Transport_Abstract */
|
||||
$instance = new $class($backup, $args);
|
||||
return $instance->send();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user