aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Factory.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/Factory.php')
-rw-r--r--app/Models/Factory.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/Models/Factory.php b/app/Models/Factory.php
new file mode 100644
index 000000000..08569b2e2
--- /dev/null
+++ b/app/Models/Factory.php
@@ -0,0 +1,32 @@
+<?php
+
+class FreshRSS_Factory {
+
+ public static function createFeedDao() {
+ $db = Minz_Configuration::dataBase();
+ if ($db['type'] === 'sqlite') {
+ return new FreshRSS_FeedDAOSQLite();
+ } else {
+ return new FreshRSS_FeedDAO();
+ }
+ }
+
+ public static function createEntryDao() {
+ $db = Minz_Configuration::dataBase();
+ if ($db['type'] === 'sqlite') {
+ return new FreshRSS_EntryDAOSQLite();
+ } else {
+ return new FreshRSS_EntryDAO();
+ }
+ }
+
+ public static function createStatsDAO() {
+ $db = Minz_Configuration::dataBase();
+ if ($db['type'] === 'sqlite') {
+ return new FreshRSS_StatsDAOSQLite();
+ } else {
+ return new FreshRSS_StatsDAO();
+ }
+ }
+
+}