summaryrefslogtreecommitdiffstats
path: root/lib/Service
diff options
context:
space:
mode:
authorSean Molenaar <SMillerDev@users.noreply.github.com>2018-03-27 15:35:06 +0200
committerBernhard Posselt <BernhardPosselt@users.noreply.github.com>2018-03-27 15:35:06 +0200
commit5b94705cf3918dc7986c6043b1fbe776bf22958f (patch)
tree4e8059818a0a913d24938e35238913a721fa6373 /lib/Service
parentf3c9d13551cef5968baea99c2f25085baee0ed5f (diff)
Core: Fix compatibility with nextcloud codestyle (#280)
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/FeedService.php142
-rw-r--r--lib/Service/FolderService.php87
-rw-r--r--lib/Service/ItemService.php202
-rw-r--r--lib/Service/Service.php30
-rw-r--r--lib/Service/ServiceConflictException.php15
-rw-r--r--lib/Service/ServiceException.php15
-rw-r--r--lib/Service/ServiceNotFoundException.php15
-rw-r--r--lib/Service/ServiceValidationException.php15
-rw-r--r--lib/Service/StatusService.php20
9 files changed, 322 insertions, 219 deletions
diff --git a/lib/Service/FeedService.php b/lib/Service/FeedService.php
index d24fd259e..de6fad257 100644
--- a/lib/Service/FeedService.php
+++ b/lib/Service/FeedService.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Service;
@@ -29,7 +29,8 @@ use OCA\News\Config\Config;
use OCA\News\Utility\Time;
-class FeedService extends Service {
+class FeedService extends Service
+{
private $feedFetcher;
private $itemMapper;
@@ -42,14 +43,15 @@ class FeedService extends Service {
private $loggerParams;
public function __construct(FeedMapper $feedMapper,
- Fetcher $feedFetcher,
- ItemMapper $itemMapper,
- ILogger $logger,
- IL10N $l10n,
- Time $timeFactory,
- Config $config,
- HTMLPurifier $purifier,
- $LoggerParameters){
+ Fetcher $feedFetcher,
+ ItemMapper $itemMapper,
+ ILogger $logger,
+ IL10N $l10n,
+ Time $timeFactory,
+ Config $config,
+ HTMLPurifier $purifier,
+ $LoggerParameters
+ ) {
parent::__construct($feedMapper);
$this->feedFetcher = $feedFetcher;
$this->itemMapper = $itemMapper;
@@ -65,53 +67,63 @@ class FeedService extends Service {
/**
* Finds all feeds of a user
- * @param string $userId the name of the user
+ *
+ * @param string $userId the name of the user
* @return Feed[]
*/
- public function findAll($userId){
+ public function findAll($userId)
+ {
return $this->feedMapper->findAllFromUser($userId);
}
/**
* Finds all feeds from all users
+ *
* @return array of feeds
*/
- public function findAllFromAllUsers() {
+ public function findAllFromAllUsers()
+ {
return $this->feedMapper->findAll();
}
/**
* Creates a new feed
- * @param string $feedUrl the url to the feed
- * @param int $folderId the folder where it should be put into, 0 for root
- * folder
- * @param string $userId for which user the feed should be created
- * @param string $title if given, this is used for the opml feed title
- * @param string $basicAuthUser if given, basic auth is set for this feed
- * @param string $basicAuthPassword if given, basic auth is set for this
- * feed. Ignored if user is null or an empty string
+ *
+ * @param string $feedUrl the url to the feed
+ * @param int $folderId the folder where it should be put into, 0 for root
+ * folder
+ * @param string $userId for which user the feed should be created
+ * @param string $title if given, this is used for the opml feed title
+ * @param string $basicAuthUser if given, basic auth is set for this feed
+ * @param string $basicAuthPassword if given, basic auth is set for this
+ * feed. Ignored if user is null or an empty string
* @throws ServiceConflictException if the feed exists already
* @throws ServiceNotFoundException if the url points to an invalid feed
* @return Feed the newly created feed
*/
public function create($feedUrl, $folderId, $userId, $title=null,
- $basicAuthUser=null, $basicAuthPassword=null){
+ $basicAuthUser=null, $basicAuthPassword=null
+ ) {
// first try if the feed exists already
try {
- list($feed, $items) = $this->feedFetcher->fetch($feedUrl, true,
- null, null, false, $basicAuthUser,
- $basicAuthPassword);
+ list($feed, $items) = $this->feedFetcher->fetch(
+ $feedUrl, true,
+ null, null, false, $basicAuthUser,
+ $basicAuthPassword
+ );
// try again if feed exists depending on the reported link
try {
$this->feedMapper->findByUrlHash($feed->getUrlHash(), $userId);
throw new ServiceConflictException(
- $this->l10n->t('Can not add feed: Exists already'));
+ $this->l10n->t('Can not add feed: Exists already')
+ );
- // If no matching feed was found everything was ok
- } catch(DoesNotExistException $ex){}
+ // If no matching feed was found everything was ok
+ } catch(DoesNotExistException $ex){
+ }
// insert feed
$itemCount = count($items);
@@ -138,7 +150,8 @@ class FeedService extends Service {
// and ignore it if it does
try {
$this->itemMapper->findByGuidHash(
- $item->getGuidHash(), $item->getFeedId(), $userId);
+ $item->getGuidHash(), $item->getFeedId(), $userId
+ );
continue;
} catch(DoesNotExistException $ex){
$unreadCount += 1;
@@ -161,7 +174,8 @@ class FeedService extends Service {
/**
* Runs all the feed updates
*/
- public function updateAll(){
+ public function updateAll()
+ {
// TODO: this method is not covered by any tests
$feeds = $this->feedMapper->findAll();
foreach($feeds as $feed){
@@ -180,13 +194,15 @@ class FeedService extends Service {
/**
* Updates a single feed
- * @param int $feedId the id of the feed that should be updated
- * @param string $userId the id of the user
- * @param bool $forceUpdate update even if the article exists already
+ *
+ * @param int $feedId the id of the feed that should be updated
+ * @param string $userId the id of the user
+ * @param bool $forceUpdate update even if the article exists already
* @throws ServiceNotFoundException if the feed does not exist
* @return Feed the updated feed entity
*/
- public function update($feedId, $userId, $forceUpdate=false){
+ public function update($feedId, $userId, $forceUpdate=false)
+ {
$existingFeed = $this->find($feedId, $userId);
if($existingFeed->getPreventUpdate() === true) {
@@ -229,7 +245,8 @@ class FeedService extends Service {
}
$existingFeed->setHttpLastModified(
- $fetchedFeed->getHttpLastModified());
+ $fetchedFeed->getHttpLastModified()
+ );
$existingFeed->setHttpEtag($fetchedFeed->getHttpEtag());
$existingFeed->setLocation($fetchedFeed->getLocation());
@@ -245,8 +262,9 @@ class FeedService extends Service {
);
// in case of update
- if ($forceUpdate ||
- $item->getUpdatedDate() > $dbItem->getUpdatedDate()) {
+ if ($forceUpdate
+ || $item->getUpdatedDate() > $dbItem->getUpdatedDate()
+ ) {
$dbItem->setTitle($item->getTitle());
$dbItem->setUrl($item->getUrl());
@@ -295,11 +313,13 @@ class FeedService extends Service {
/**
* Import articles
- * @param array $json the array with json
- * @param string $userId the username
+ *
+ * @param array $json the array with json
+ * @param string $userId the username
* @return Feed if one had to be created for nonexistent feeds
*/
- public function importArticles($json, $userId) {
+ public function importArticles($json, $userId)
+ {
$url = 'http://nextcloud/nofeed';
$urlHash = md5($url);
@@ -343,7 +363,8 @@ class FeedService extends Service {
try {
// if item exists, copy the status
$existingItem = $this->itemMapper->findByGuidHash(
- $item->getGuidHash(), $feed->getId(), $userId);
+ $item->getGuidHash(), $feed->getId(), $userId
+ );
$existingItem->setStatus($item->getStatus());
$this->itemMapper->update($existingItem);
} catch(DoesNotExistException $ex){
@@ -363,11 +384,13 @@ class FeedService extends Service {
/**
* Use this to mark a feed as deleted. That way it can be un-deleted
- * @param int $feedId the id of the feed that should be deleted
- * @param string $userId the name of the user for security reasons
+ *
+ * @param int $feedId the id of the feed that should be deleted
+ * @param string $userId the name of the user for security reasons
* @throws ServiceNotFoundException when feed does not exist
*/
- public function markDeleted($feedId, $userId) {
+ public function markDeleted($feedId, $userId)
+ {
$feed = $this->find($feedId, $userId);
$feed->setDeletedAt($this->timeFactory->getTime());
$this->feedMapper->update($feed);
@@ -376,11 +399,13 @@ class FeedService extends Service {
/**
* Use this to undo a feed deletion
- * @param int $feedId the id of the feed that should be restored
- * @param string $userId the name of the user for security reasons
+ *
+ * @param int $feedId the id of the feed that should be restored
+ * @param string $userId the name of the user for security reasons
* @throws ServiceNotFoundException when feed does not exist
*/
- public function unmarkDeleted($feedId, $userId) {
+ public function unmarkDeleted($feedId, $userId)
+ {
$feed = $this->find($feedId, $userId);
$feed->setDeletedAt(0);
$this->feedMapper->update($feed);
@@ -389,12 +414,14 @@ class FeedService extends Service {
/**
* Deletes all deleted feeds
- * @param string $userId if given it purges only feeds of that user
+ *
+ * @param string $userId if given it purges only feeds of that user
* @param boolean $useInterval defaults to true, if true it only purges
- * entries in a given interval to give the user a chance to undo the
- * deletion
+ * entries in a given interval to give the user a chance to undo the
+ * deletion
*/
- public function purgeDeleted($userId=null, $useInterval=true) {
+ public function purgeDeleted($userId=null, $useInterval=true)
+ {
$deleteOlderThan = null;
if ($useInterval) {
@@ -413,9 +440,11 @@ class FeedService extends Service {
/**
* Deletes all feeds of a user, delete items first since the user_id
* is not defined in there
+ *
* @param string $userId the name of the user
*/
- public function deleteUser($userId) {
+ public function deleteUser($userId)
+ {
$this->feedMapper->deleteUser($userId);
}
@@ -432,7 +461,8 @@ class FeedService extends Service {
* ]
* @throws ServiceNotFoundException if feed does not exist
*/
- public function patch($feedId, $userId, $diff=[]) {
+ public function patch($feedId, $userId, $diff=[])
+ {
$feed = $this->find($feedId, $userId);
foreach ($diff as $attribute => $value) {
diff --git a/lib/Service/FolderService.php b/lib/Service/FolderService.php
index 8eebf60ba..75aa294e1 100644
--- a/lib/Service/FolderService.php
+++ b/lib/Service/FolderService.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Service;
@@ -20,7 +20,8 @@ use OCA\News\Config\Config;
use OCA\News\Utility\Time;
-class FolderService extends Service {
+class FolderService extends Service
+{
private $l10n;
private $timeFactory;
@@ -28,9 +29,10 @@ class FolderService extends Service {
private $folderMapper;
public function __construct(FolderMapper $folderMapper,
- IL10N $l10n,
- Time $timeFactory,
- Config $config){
+ IL10N $l10n,
+ Time $timeFactory,
+ Config $config
+ ) {
parent::__construct($folderMapper);
$this->l10n = $l10n;
$this->timeFactory = $timeFactory;
@@ -41,21 +43,25 @@ class FolderService extends Service {
/**
* Returns all folders of a user
- * @param string $userId the name of the user
+ *
+ * @param string $userId the name of the user
* @return array of folders
*/
- public function findAll($userId) {
+ public function findAll($userId)
+ {
return $this->folderMapper->findAllFromUser($userId);
}
- private function validateFolder($folderName, $userId){
+ private function validateFolder($folderName, $userId)
+ {
$existingFolders =
$this->folderMapper->findByName($folderName, $userId);
- if(count($existingFolders) > 0){
+ if(count($existingFolders) > 0) {
throw new ServiceConflictException(
- $this->l10n->t('Can not add folder: Exists already'));
+ $this->l10n->t('Can not add folder: Exists already')
+ );
}
if(mb_strlen($folderName) === 0) {
@@ -68,15 +74,17 @@ class FolderService extends Service {
/**
* Creates a new folder
- * @param string $folderName the name of the folder
- * @param string $userId the name of the user for whom it should be created
- * @param int $parentId the parent folder id, deprecated we don't nest
- * folders
+ *
+ * @param string $folderName the name of the folder
+ * @param string $userId the name of the user for whom it should be created
+ * @param int $parentId the parent folder id, deprecated we don't nest
+ * folders
* @throws ServiceConflictException if name exists already
* @throws ServiceValidationException if the folder has invalid parameters
* @return Folder the newly created folder
*/
- public function create($folderName, $userId, $parentId=0) {
+ public function create($folderName, $userId, $parentId=0)
+ {
$this->validateFolder($folderName, $userId);
$folder = new Folder();
@@ -91,7 +99,8 @@ class FolderService extends Service {
/**
* @throws ServiceException if the folder does not exist
*/
- public function open($folderId, $opened, $userId){
+ public function open($folderId, $opened, $userId)
+ {
$folder = $this->find($folderId, $userId);
$folder->setOpened($opened);
$this->folderMapper->update($folder);
@@ -100,15 +109,17 @@ class FolderService extends Service {
/**
* Renames a folder
- * @param int $folderId the id of the folder that should be deleted
- * @param string $folderName the new name of the folder
- * @param string $userId the name of the user for security reasons
+ *
+ * @param int $folderId the id of the folder that should be deleted
+ * @param string $folderName the new name of the folder
+ * @param string $userId the name of the user for security reasons
* @throws ServiceConflictException if name exists already
* @throws ServiceValidationException if the folder has invalid parameters
* @throws ServiceNotFoundException if the folder does not exist
* @return Folder the updated folder
*/
- public function rename($folderId, $folderName, $userId){
+ public function rename($folderId, $folderName, $userId)
+ {
$this->validateFolder($folderName, $userId);
$folder = $this->find($folderId, $userId);
@@ -119,11 +130,13 @@ class FolderService extends Service {
/**
* Use this to mark a folder as deleted. That way it can be un-deleted
- * @param int $folderId the id of the folder that should be deleted
- * @param string $userId the name of the user for security reasons
+ *
+ * @param int $folderId the id of the folder that should be deleted
+ * @param string $userId the name of the user for security reasons
* @throws ServiceNotFoundException when folder does not exist
*/
- public function markDeleted($folderId, $userId) {
+ public function markDeleted($folderId, $userId)
+ {
$folder = $this->find($folderId, $userId);
$folder->setDeletedAt($this->timeFactory->getTime());
$this->folderMapper->update($folder);
@@ -132,11 +145,13 @@ class FolderService extends Service {
/**
* Use this to restore a folder
- * @param int $folderId the id of the folder that should be restored
- * @param string $userId the name of the user for security reasons
+ *
+ * @param int $folderId the id of the folder that should be restored
+ * @param string $userId the name of the user for security reasons
* @throws ServiceNotFoundException when folder does not exist
*/
- public function unmarkDeleted($folderId, $userId) {
+ public function unmarkDeleted($folderId, $userId)
+ {
$folder = $this->find($folderId, $userId);
$folder->setDeletedAt(0);
$this->folderMapper->update($folder);
@@ -145,12 +160,14 @@ class FolderService extends Service {
/**
* Deletes all deleted folders
- * @param string $userId if given it purges only folders of that user
+ *
+ * @param string $userId if given it purges only folders of that user
* @param boolean $useInterval defaults to true, if true it only purges
- * entries in a given interval to give the user a chance to undo the
- * deletion
+ * entries in a given interval to give the user a chance to undo the
+ * deletion
*/
- public function purgeDeleted($userId=null, $useInterval=true) {
+ public function purgeDeleted($userId=null, $useInterval=true)
+ {
$deleteOlderThan = null;
if ($useInterval) {
@@ -168,9 +185,11 @@ class FolderService extends Service {
/**
* Deletes all folders of a user
+ *
* @param string $userId the name of the user
*/
- public function deleteUser($userId) {
+ public function deleteUser($userId)
+ {
$this->folderMapper->deleteUser($userId);
}
diff --git a/lib/Service/ItemService.php b/lib/Service/ItemService.php
index fee00ffc2..bc108b034 100644
--- a/lib/Service/ItemService.php
+++ b/lib/Service/ItemService.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Service;
@@ -23,7 +23,8 @@ use OCA\News\Config\Config;
use OCA\News\Utility\Time;
-class ItemService extends Service {
+class ItemService extends Service
+{
private $config;
private $timeFactory;
@@ -31,9 +32,10 @@ class ItemService extends Service {
private $systemConfig;
public function __construct(ItemMapper $itemMapper,
- Time $timeFactory,
- Config $config,
- IConfig $systemConfig){
+ Time $timeFactory,
+ Config $config,
+ IConfig $systemConfig
+ ) {
parent::__construct($itemMapper);
$this->config = $config;
$this->timeFactory = $timeFactory;
@@ -44,78 +46,88 @@ class ItemService extends Service {
/**
* Returns all new items
- * @param int $id the id of the feed, 0 for starred or all items
- * @param int $type the type of the feed
- * @param int $updatedSince a timestamp with the last modification date
- * returns only items with a >= modified timestamp
- * @param boolean $showAll if unread items should also be returned
- * @param string $userId the name of the user
+ *
+ * @param int $id the id of the feed, 0 for starred or all items
+ * @param int $type the type of the feed
+ * @param int $updatedSince a timestamp with the last modification date
+ * returns only items with a >= modified
+ * timestamp
+ * @param boolean $showAll if unread items should also be returned
+ * @param string $userId the name of the user
* @return array of items
*/
- public function findAllNew($id, $type, $updatedSince, $showAll, $userId){
+ public function findAllNew($id, $type, $updatedSince, $showAll, $userId)
+ {
switch($type){
- case FeedType::FEED:
- return $this->itemMapper->findAllNewFeed(
- $id, $updatedSince, $showAll, $userId
- );
- case FeedType::FOLDER:
- return $this->itemMapper->findAllNewFolder(
- $id, $updatedSince, $showAll, $userId
- );
- default:
- return $this->itemMapper->findAllNew(
- $updatedSince, $type, $showAll, $userId
- );
+ case FeedType::FEED:
+ return $this->itemMapper->findAllNewFeed(
+ $id, $updatedSince, $showAll, $userId
+ );
+ case FeedType::FOLDER:
+ return $this->itemMapper->findAllNewFolder(
+ $id, $updatedSince, $showAll, $userId
+ );
+ default:
+ return $this->itemMapper->findAllNew(
+ $updatedSince, $type, $showAll, $userId
+ );
}
}
/**
* Returns all items
- * @param int $id the id of the feed, 0 for starred or all items
- * @param int $type the type of the feed
- * @param int $limit how many items should be returned
- * @param int $offset the offset
- * @param boolean $showAll if unread items should also be returned
- * @param boolean $oldestFirst if it should be ordered by oldest first
- * @param string $userId the name of the user
- * @param string[] $search an array of keywords that the result should
- * contain in either the author, title, link or body
+ *
+ * @param int $id the id of the feed, 0 for starred or all items
+ * @param int $type the type of the feed
+ * @param int $limit how many items should be returned
+ * @param int $offset the offset
+ * @param boolean $showAll if unread items should also be returned
+ * @param boolean $oldestFirst if it should be ordered by oldest first
+ * @param string $userId the name of the user
+ * @param string[] $search an array of keywords that the result should
+ * contain in either the author, title, link
+ * or body
* @return array of items
*/
public function findAll($id, $type, $limit, $offset, $showAll, $oldestFirst,
- $userId, $search=[]){
+ $userId, $search=[]
+ ) {
switch($type){
- case FeedType::FEED:
- return $this->itemMapper->findAllFeed(
- $id, $limit, $offset, $showAll, $oldestFirst, $userId,
- $search
- );
- case FeedType::FOLDER:
- return $this->itemMapper->findAllFolder(
- $id, $limit, $offset, $showAll, $oldestFirst, $userId,
- $search
- );
- default:
- return $this->itemMapper->findAll(
- $limit, $offset, $type, $showAll, $oldestFirst, $userId, $search
- );
+ case FeedType::FEED:
+ return $this->itemMapper->findAllFeed(
+ $id, $limit, $offset, $showAll, $oldestFirst, $userId,
+ $search
+ );
+ case FeedType::FOLDER:
+ return $this->itemMapper->findAllFolder(
+ $id, $limit, $offset, $showAll, $oldestFirst, $userId,
+ $search
+ );
+ default:
+ return $this->itemMapper->findAll(
+ $limit, $offset, $type, $showAll, $oldestFirst, $userId, $search
+ );
}
}
/**
* Star or unstar an item
- * @param int $feedId the id of the item's feed that should be starred
- * @param string $guidHash the guidHash of the item that should be starred
- * @param boolean $isStarred if true the item will be marked as starred,
- * if false unstar
- * @param string $userId the name of the user for security reasons
+ *
+ * @param int $feedId the id of the item's feed that should be starred
+ * @param string $guidHash the guidHash of the item that should be starred
+ * @param boolean $isStarred if true the item will be marked as starred,
+ * if false unstar
+ * @param string $userId the name of the user for security reasons
* @throws ServiceNotFoundException if the item does not exist
*/
- public function star($feedId, $guidHash, $isStarred, $userId){
+ public function star($feedId, $guidHash, $isStarred, $userId)
+ {
try {
- /** @var Item $item */
+ /**
+ * @var Item $item
+*/
$item = $this->itemMapper->findByGuidHash(
$guidHash, $feedId, $userId
);
@@ -131,13 +143,15 @@ class ItemService extends Service {
/**
* Read or unread an item
- * @param int $itemId the id of the item that should be read
- * @param boolean $isRead if true the item will be marked as read,
- * if false unread
- * @param string $userId the name of the user for security reasons
+ *
+ * @param int $itemId the id of the item that should be read
+ * @param boolean $isRead if true the item will be marked as read,
+ * if false unread
+ * @param string $userId the name of the user for security reasons
* @throws ServiceNotFoundException if the item does not exist
*/
- public function read($itemId, $isRead, $userId){
+ public function read($itemId, $isRead, $userId)
+ {
try {
$lastModified = $this->timeFactory->getMicroTime();
$this->itemMapper->readItem($itemId, $isRead, $lastModified, $userId);
@@ -149,11 +163,14 @@ class ItemService extends Service {
/**
* Set all items read
- * @param int $highestItemId all items below that are marked read. This is
- * used to prevent marking items as read that the users hasn't seen yet
- * @param string $userId the name of the user
+ *
+ * @param int $highestItemId all items below that are marked read. This is
+ * used to prevent marking items as read that
+ * the users hasn't seen yet
+ * @param string $userId the name of the user
*/
- public function readAll($highestItemId, $userId){
+ public function readAll($highestItemId, $userId)
+ {
$time = $this->timeFactory->getMicroTime();
$this->itemMapper->readAll($highestItemId, $time, $userId);
}
@@ -161,12 +178,15 @@ class ItemService extends Service {
/**
* Set a folder read
- * @param int $folderId the id of the folder that should be marked read
- * @param int $highestItemId all items below that are marked read. This is
- * used to prevent marking items as read that the users hasn't seen yet
- * @param string $userId the name of the user
+ *
+ * @param int $folderId the id of the folder that should be marked read
+ * @param int $highestItemId all items below that are marked read. This is
+ * used to prevent marking items as read that
+ * the users hasn't seen yet
+ * @param string $userId the name of the user
*/
- public function readFolder($folderId, $highestItemId, $userId){
+ public function readFolder($folderId, $highestItemId, $userId)
+ {
$time = $this->timeFactory->getMicroTime();
$this->itemMapper->readFolder(
$folderId, $highestItemId, $time, $userId
@@ -176,12 +196,15 @@ class ItemService extends Service {
/**
* Set a feed read
- * @param int $feedId the id of the feed that should be marked read
- * @param int $highestItemId all items below that are marked read. This is
- * used to prevent marking items as read that the users hasn't seen yet
- * @param string $userId the name of the user
+ *
+ * @param int $feedId the id of the feed that should be marked read
+ * @param int $highestItemId all items below that are marked read. This is
+ * used to prevent marking items as read that
+ * the users hasn't seen yet
+ * @param string $userId the name of the user
*/
- public function readFeed($feedId, $highestItemId, $userId){
+ public function readFeed($feedId, $highestItemId, $userId)
+ {
$time = $this->timeFactory->getMicroTime();
$this->itemMapper->readFeed($feedId, $highestItemId, $time, $userId);
}
@@ -193,7 +216,8 @@ class ItemService extends Service {
* up the database so that old entries don't spam your db. As criteria for
* old, the id is taken
*/
- public function autoPurgeOld(){
+ public function autoPurgeOld()
+ {
$count = $this->config->getAutoPurgeCount();
if ($count >= 0) {
$this->itemMapper->deleteReadOlderThanThreshold($count);
@@ -203,11 +227,13 @@ class ItemService extends Service {
/**
* Returns the newest item id, use this for marking feeds read
- * @param string $userId the name of the user
+ *
+ * @param string $userId the name of the user
* @throws ServiceNotFoundException if there is no newest item
* @return int
*/
- public function getNewestItemId($userId) {
+ public function getNewestItemId($userId)
+ {
try {
return $this->itemMapper->getNewestItemId($userId);
} catch(DoesNotExistException $ex) {
@@ -218,10 +244,12 @@ class ItemService extends Service {
/**
* Returns the starred count
- * @param string $userId the name of the user
+ *
+ * @param string $userId the name of the user
* @return int the count
*/
- public function starredCount($userId){
+ public function starredCount($userId)
+ {
return $this->itemMapper->starredCount($userId);
}
@@ -230,16 +258,19 @@ class ItemService extends Service {
* @param string $userId from which user the items should be taken
* @return array of items which are starred or unread
*/
- public function getUnreadOrStarred($userId) {
+ public function getUnreadOrStarred($userId)
+ {
return $this->itemMapper->findAllUnreadOrStarred($userId);
}
/**
* Deletes all items of a user
+ *
* @param string $userId the name of the user
*/
- public function deleteUser($userId) {
+ public function deleteUser($userId)
+ {
$this->itemMapper->deleteUser($userId);
}
@@ -247,7 +278,8 @@ class ItemService extends Service {
/**
* Regenerates the search index for all items
*/
- public function generateSearchIndices() {
+ public function generateSearchIndices()
+ {
$this->itemMapper->updateSearchIndices();
}
diff --git a/lib/Service/Service.php b/lib/Service/Service.php
index e8fd4c72c..28cfeeb76 100644
--- a/lib/Service/Service.php
+++ b/lib/Service/Service.php