diff options
| author | 2014-10-22 17:57:22 +0200 | |
|---|---|---|
| committer | 2014-10-22 17:57:22 +0200 | |
| commit | 98587d5d617f157ba57a260091c8e2c944f5163f (patch) | |
| tree | 24760d52ffc5d3411e986749054d08e3c63fc002 /app/Models/Context.php | |
| parent | f1f9b2f5ff60f6dca05fad831b766ea7d63ff3a3 (diff) | |
Fix a set of TODO and bugs
- Context object raises correct Exception if get is invalid
- RSS feed is well-indicated on the home page
- State is better calculated
- Add some comments
See https://github.com/marienfressinaud/FreshRSS/issues/634
Diffstat (limited to 'app/Models/Context.php')
| -rw-r--r-- | app/Models/Context.php | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/app/Models/Context.php b/app/Models/Context.php index 54fb1e64a..4580a4f52 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -17,14 +17,15 @@ class FreshRSS_Context { 'unread' => 0, ); - public static $state = 0; + public static $get_unread = 0; public static $current_get = array( 'all' => false, 'starred' => false, 'feed' => false, 'category' => false, ); - public static $get_unread = 0; + + public static $state = 0; public static $order = 'DESC'; public static $number = 0; public static $search = ''; @@ -48,8 +49,6 @@ class FreshRSS_Context { $catDAO = new FreshRSS_CategoryDAO(); $entryDAO = FreshRSS_Factory::createEntryDao(); - // Get the current state. - // self::$state = self::$conf->default_view; self::$categories = $catDAO->listCategories(); // Update number of read / unread variables. @@ -97,8 +96,7 @@ class FreshRSS_Context { $feed = $feedDAO->searchById($id); if (!$feed) { - // TODO: raise an exception - return false; + throw new FreshRSS_Context_Exception('Invalid feed: ' . $id); } } @@ -112,8 +110,7 @@ class FreshRSS_Context { $cat = $catDAO->searchById($id); if (!$cat) { - // TODO: raise an exception - return false; + throw new FreshRSS_Context_Exception('Invalid category: ' . $id); } } else { $cat = self::$categories[$id]; @@ -123,8 +120,7 @@ class FreshRSS_Context { self::$get_unread = $cat->nbNotRead(); break; default: - // TODO: raise an exception! - return false; + throw new FreshRSS_Context_Exception('Invalid getter: ' . $get); } } |
