From 66c73a96ac2dda076bcfe0dc0a1ca2a7e169149d Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Tue, 21 Oct 2014 18:19:23 +0200 Subject: first try to set indention limit at 80 characters in php --- service/feedservice.php | 45 ++++++++++++++++++++++++++++++--------------- service/folderservice.php | 13 +++++++++---- service/itemservice.php | 26 ++++++++++++++++---------- 3 files changed, 55 insertions(+), 29 deletions(-) (limited to 'service') diff --git a/service/feedservice.php b/service/feedservice.php index ca3335396..872f05ef8 100644 --- a/service/feedservice.php +++ b/service/feedservice.php @@ -56,7 +56,8 @@ class FeedService extends Service { $this->logger = $logger; $this->l10n = $l10n; $this->timeFactory = $timeFactory; - $this->autoPurgeMinimumInterval = $config->getAutoPurgeMinimumInterval(); + $this->autoPurgeMinimumInterval = + $config->getAutoPurgeMinimumInterval(); $this->enhancer = $enhancer; $this->purifier = $purifier; $this->feedMapper = $feedMapper; @@ -85,7 +86,8 @@ class FeedService extends Service { /** * 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 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 * @throws ServiceConflictException if the feed exists already @@ -117,8 +119,8 @@ class FeedService extends Service { $feed = $this->feedMapper->insert($feed); - // insert items in reverse order because the first one is usually the - // newest item + // insert items in reverse order because the first one is usually + // the newest item $unreadCount = 0; for($i=count($items)-1; $i>=0; $i--){ $item = $items[$i]; @@ -146,8 +148,11 @@ class FeedService extends Service { $this->logger->debug($ex->getMessage(), $this->loggerParams); throw new ServiceNotFoundException( $this->l10n->t( - 'Can not add feed: URL does not exist, SSL Certificate can not be validated ' . - 'or feed has invalid xml')); + 'Can not add feed: URL does not exist, ' . + 'SSL Certificate can not be validated ' . + 'or feed has invalid xml' + ) + ); } } @@ -162,8 +167,10 @@ class FeedService extends Service { try { $this->update($feed->getId(), $feed->getUserId()); } catch(\Exception $ex){ - $this->logger->debug('Could not update feed ' . $ex->getMessage(), - $this->loggerParams); + $this->logger->debug( + 'Could not update feed ' . $ex->getMessage(), + $this->loggerParams + ); } } } @@ -194,18 +201,22 @@ class FeedService extends Service { $this->feedMapper->update($existingFeed); } - // insert items in reverse order because the first one is usually - // the newest item + // insert items in reverse order because the first one is + // usually the newest item for($i=count($items)-1; $i>=0; $i--){ $item = $items[$i]; $item->setFeedId($existingFeed->getId()); try { - $this->itemMapper->findByGuidHash($item->getGuidHash(), $feedId, $userId); + $this->itemMapper->findByGuidHash( + $item->getGuidHash(), $feedId, $userId + ); } catch(DoesNotExistException $ex){ $item = $this->enhancer->enhance($item, $existingFeed->getLink()); - $item->setBody($this->purifier->purify($item->getBody())); + $item->setBody( + $this->purifier->purify($item->getBody()) + ); $this->itemMapper->insert($item); } } @@ -213,8 +224,11 @@ class FeedService extends Service { } catch(FetcherException $ex){ // failed updating is not really a problem, so only log it - $this->logger->debug('Can not update feed with url ' . $existingFeed->getUrl() . - ': Not found or bad source', $this->loggerParams); + $this->logger->debug( + 'Can not update feed with url ' . $existingFeed->getUrl() . + ': Not found or bad source', + $this->loggerParams + ); $this->logger->debug($ex->getMessage(), $this->loggerParams); } @@ -230,7 +244,8 @@ class FeedService extends Service { /** * Moves a feed into a different folder * @param int $feedId the id of the feed that should be moved - * @param int $folderId the id of the folder where the feed should be moved to + * @param int $folderId the id of the folder where the feed should be moved + * to * @param string $userId the name of the user whose feed should be moved * @throws ServiceNotFoundException if the feed does not exist */ diff --git a/service/folderservice.php b/service/folderservice.php index eb1e584f5..982837c92 100644 --- a/service/folderservice.php +++ b/service/folderservice.php @@ -34,7 +34,8 @@ class FolderService extends Service { parent::__construct($folderMapper); $this->l10n = $l10n; $this->timeFactory = $timeFactory; - $this->autoPurgeMinimumInterval = $config->getAutoPurgeMinimumInterval(); + $this->autoPurgeMinimumInterval = + $config->getAutoPurgeMinimumInterval(); $this->folderMapper = $folderMapper; } @@ -49,7 +50,8 @@ class FolderService extends Service { private function validateFolder($folderName, $userId){ - $existingFolders = $this->folderMapper->findByName($folderName, $userId); + $existingFolders = + $this->folderMapper->findByName($folderName, $userId); if(count($existingFolders) > 0){ throw new ServiceConflictException( @@ -57,7 +59,9 @@ class FolderService extends Service { } if(mb_strlen($folderName) === 0) { - throw new ServiceValidationException('Folder name can not be empty'); + throw new ServiceValidationException( + 'Folder name can not be empty' + ); } } @@ -66,7 +70,8 @@ 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 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 diff --git a/service/itemservice.php b/service/itemservice.php index 1b94c089f..628f89206 100644 --- a/service/itemservice.php +++ b/service/itemservice.php @@ -106,13 +106,16 @@ class ItemService extends Service { * 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 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){ try { - $item = $this->itemMapper->findByGuidHash($guidHash, $feedId, $userId); + $item = $this->itemMapper->findByGuidHash( + $guidHash, $feedId, $userId + ); $item->setLastModified($this->timeFactory->getTime()); if($isStarred){ @@ -130,7 +133,8 @@ 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 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 */ @@ -148,8 +152,8 @@ 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 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){ @@ -161,21 +165,23 @@ 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 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){ $time = $this->timeFactory->getTime(); - $this->itemMapper->readFolder($folderId, $highestItemId, $time, $userId); + $this->itemMapper->readFolder( + $folderId, $highestItemId, $time, $userId + ); } /** * 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 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){ -- cgit v1.2.3