* @author Bernhard Posselt * @copyright Alessandro Cosentino 2012 * @copyright Bernhard Posselt 2012, 2014 */ namespace OCA\News\Db; use \OCP\IDb; use \OCA\News\Db\Mysql\ItemMapper as MysqlItemMapper; class MapperFactory { private $dbType; private $db; public function __construct($dbType, IDb $db) { $this->dbType = $dbType; $this->db = $db; } public function getItemMapper() { switch($this->dbType) { case 'mysql': return new MysqlItemMapper($this->db); default: return new ItemMapper($this->db); } } }