summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-10-21 17:02:59 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-10-21 17:02:59 +0200
commitf5e64d35c05b14016eb4fffff7199386a97a9b43 (patch)
tree6718fcbff1cbcde011bf199accc7f2291abff886 /controller
parent36ac7743ca845888b3eacd411fbaf3993c68876a (diff)
use spaces for indention in itemcontroller class
Diffstat (limited to 'controller')
-rw-r--r--controller/itemcontroller.php196
1 files changed, 98 insertions, 98 deletions
diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php
index d62e704f7..89dd51d03 100644
--- a/controller/itemcontroller.php
+++ b/controller/itemcontroller.php
@@ -26,25 +26,25 @@ use \OCA\News\Service\FeedService;
class ItemController extends Controller {
- use JSONHttpError;
-
- private $itemService;
- private $feedService;
- private $userId;
- private $settings;
-
- public function __construct($appName,
- IRequest $request,
- FeedService $feedService,
- ItemService $itemService,
- IConfig $settings,
- $userId){
- parent::__construct($appName, $request);
- $this->itemService = $itemService;
- $this->feedService = $feedService;
- $this->userId = $userId;
- $this->settings = $settings;
- }
+ use JSONHttpError;
+
+ private $itemService;
+ private $feedService;
+ private $userId;
+ private $settings;
+
+ public function __construct($appName,
+ IRequest $request,
+ FeedService $feedService,
+ ItemService $itemService,
+ IConfig $settings,
+ $userId){
+ parent::__construct($appName, $request);
+ $this->itemService = $itemService;
+ $this->feedService = $feedService;
+ $this->userId = $userId;
+ $this->settings = $settings;
+ }
/**
@@ -56,42 +56,42 @@ class ItemController extends Controller {
* @param int $offset
* @return array
*/
- public function index($type, $id, $limit=50, $offset=0) {
- $showAll = $this->settings->getUserValue($this->userId, $this->appName,
- 'showAll') === '1';
- $oldestFirst = $this->settings->getUserValue($this->userId, $this->appName,
- 'oldestFirst') === '1';
+ public function index($type, $id, $limit=50, $offset=0) {
+ $showAll = $this->settings->getUserValue($this->userId, $this->appName,
+ 'showAll') === '1';
+ $oldestFirst = $this->settings->getUserValue($this->userId, $this->appName,
+ 'oldestFirst') === '1';
- $this->settings->setUserValue($this->userId, $this->appName,
- 'lastViewedFeedId', $id);
- $this->settings->setUserValue($this->userId, $this->appName,
- 'lastViewedFeedType', $type);
+ $this->settings->setUserValue($this->userId, $this->appName,
+ 'lastViewedFeedId', $id);
+ $this->settings->setUserValue($this->userId, $this->appName,
+ 'lastViewedFeedType', $type);
- $params = [];
+ $params = [];
- try {
+ try {
- // the offset is 0 if the user clicks on a new feed
- // we need to pass the newest feeds to not let the unread count get
- // out of sync
- if($offset === 0) {
- $params['newestItemId'] =
- $this->itemService->getNewestItemId($this->userId);
- $params['feeds'] = $this->feedService->findAll($this->userId);
- $params['starred'] = $this->itemService->starredCount($this->userId);
- }
+ // the offset is 0 if the user clicks on a new feed
+ // we need to pass the newest feeds to not let the unread count get
+ // out of sync
+ if($offset === 0) {
+ $params['newestItemId'] =
+ $this->itemService->getNewestItemId($this->userId);
+ $params['feeds'] = $this->feedService->findAll($this->userId);
+ $params['starred'] = $this->itemService->starredCount($this->userId);
+ }
- $params['items'] = $this->itemService->findAll(
- $id, $type, $limit, $offset, $showAll, $oldestFirst,
- $this->userId
- );
+ $params['items'] = $this->itemService->findAll(
+ $id, $type, $limit, $offset, $showAll, $oldestFirst,
+ $this->userId
+ );
- // this gets thrown if there are no items
- // in that case just return an empty array
- } catch(ServiceException $ex) {}
+ // this gets thrown if there are no items
+ // in that case just return an empty array
+ } catch(ServiceException $ex) {}
- return $params;
- }
+ return $params;
+ }
/**
@@ -102,25 +102,25 @@ class ItemController extends Controller {
* @param int $lastModified
* @return array
*/
- public function newItems($type, $id, $lastModified=0) {
- $showAll = $this->settings->getUserValue($this->userId, $this->appName,
- 'showAll') === '1';
+ public function newItems($type, $id, $lastModified=0) {
+ $showAll = $this->settings->getUserValue($this->userId, $this->appName,
+ 'showAll') === '1';
- $params = [];
+ $params = [];
- try {
- $params['newestItemId'] = $this->itemService->getNewestItemId($this->userId);
- $params['feeds'] = $this->feedService->findAll($this->userId);
- $params['starred'] = $this->itemService->starredCount($this->userId);
- $params['items'] = $this->itemService->findAllNew($id, $type,
- $lastModified, $showAll, $this->userId);
+ try {
+ $params['newestItemId'] = $this->itemService->getNewestItemId($this->userId);
+ $params['feeds'] = $this->feedService->findAll($this->userId);
+ $params['starred'] = $this->itemService->starredCount($this->userId);
+ $params['items'] = $this->itemService->findAllNew($id, $type,
+ $lastModified, $showAll, $this->userId);
- // this gets thrown if there are no items
- // in that case just return an empty array
- } catch(ServiceException $ex) {}
+ // this gets thrown if there are no items
+ // in that case just return an empty array
+ } catch(ServiceException $ex) {}
- return $params;
- }
+ return $params;
+ }
/**
@@ -131,16 +131,16 @@ class ItemController extends Controller {
* @param bool $isStarred
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function star($feedId, $guidHash, $isStarred){
- try {
- $this->itemService->star($feedId, $guidHash, $isStarred,
- $this->userId);
- } catch(ServiceException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function star($feedId, $guidHash, $isStarred){
+ try {
+ $this->itemService->star($feedId, $guidHash, $isStarred,
+ $this->userId);
+ } catch(ServiceException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -150,15 +150,15 @@ class ItemController extends Controller {
* @param bool $isRead
* @return array|\OCP\AppFramework\Http\JSONResponse
*/
- public function read($itemId, $isRead=true){
- try {
- $this->itemService->read($itemId, $isRead, $this->userId);
- } catch(ServiceException $ex) {
- return $this->error($ex, Http::STATUS_NOT_FOUND);
- }
+ public function read($itemId, $isRead=true){
+ try {
+ $this->itemService->read($itemId, $isRead, $this->userId);
+ } catch(ServiceException $ex) {
+ return $this->error($ex, Http::STATUS_NOT_FOUND);
+ }
return [];
- }
+ }
/**
@@ -167,26 +167,26 @@ class ItemController extends Controller {
* @param int $highestItemId
* @return array
*/
- public function readAll($highestItemId){
- $this->itemService->readAll($highestItemId, $this->userId);
- return ['feeds' => $this->feedService->findAll($this->userId)];
- }
-
-
- /**
- * @NoAdminRequired
- *
- * @param int[] item ids
- */
- public function readMultiple($itemIds) {
- foreach($itemIds as $id) {
- try {
- $this->itemService->read($id, true, $this->userId);
- } catch(ServiceNotFoundException $ex) {
- continue;
- }
- }
- }
+ public function readAll($highestItemId){
+ $this->itemService->readAll($highestItemId, $this->userId);
+ return ['feeds' => $this->feedService->findAll($this->userId)];
+ }
+
+
+ /**
+ * @NoAdminRequired
+ *
+ * @param int[] item ids
+ */
+ public function readMultiple($itemIds) {
+ foreach($itemIds as $id) {
+ try {
+ $this->itemService->read($id, true, $this->userId);
+ } catch(ServiceNotFoundException $ex) {
+ continue;
+ }
+ }
+ }
} \ No newline at end of file