westdc-zf1/application/module/Westdc/Dataimport/ProcessFactory.php

39 lines
703 B
PHP

<?php
/**
* Created by PhpStorm.
* User: liujin834
* Date: 15-1-27
* Time: 下午2:37
*/
namespace Westdc\Dataimport;
final class ProcessFactory {
protected static $instance = null;
private function __construct()
{
}
public static function Bootstrap($fileExt)
{
$namespace_root = "\\Westdc\\Dataimport\\Processing\\";
$recordType = ucfirst(strtolower($fileExt));
$_class = $namespace_root . $recordType;
if(!class_exists($_class))
throw new \RuntimeException("未知的數據文件");
if (self::$instance === null) {
self::$instance = new $_class;
}
return self::$instance;
}
}