From cd10f93e0d271840caff92b88195385a2a3f15b2 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 26 Jun 2014 11:33:44 +0200 Subject: style fixes --- appinfo/application.php | 1 - appinfo/routes.php | 2 -- articleenhancer/regexarticleenhancer.php | 1 - articleenhancer/xpatharticleenhancer.php | 4 ++-- config/appconfig.php | 16 +++++++--------- controller/entityapiserializer.php | 2 -- controller/exportcontroller.php | 1 - controller/itemcontroller.php | 1 + controller/jsonhttperror.php | 2 +- controller/pagecontroller.php | 4 ++-- controller/utilityapicontroller.php | 2 -- db/feedmapper.php | 2 +- db/imapper.php | 4 +++- db/itemmapper.php | 2 +- db/mapperfactory.php | 1 - fetcher/feedfetcher.php | 4 ++-- http/textdownloadresponse.php | 2 +- service/feedservice.php | 10 +++++----- service/folderservice.php | 2 +- service/itemservice.php | 14 +++++++------- service/service.php | 2 +- templates/main.php | 2 +- templates/part.addnew.php | 2 +- templates/part.content.php | 6 ++++-- templates/part.items.php | 8 +++++--- templates/part.settings.php | 25 +++++++++++++++++-------- utility/faviconfetcher.php | 10 ++++++---- utility/opmlexporter.php | 13 ++++++++----- utility/simplepieapifactory.php | 26 ++++++++++++++++++-------- 29 files changed, 95 insertions(+), 76 deletions(-) diff --git a/appinfo/application.php b/appinfo/application.php index ddc3cb903..e9e9c8bde 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -43,7 +43,6 @@ use \OCA\News\Utility\Config; use \OCA\News\Utility\OPMLExporter; use \OCA\News\Utility\Updater; use \OCA\News\Utility\SimplePieAPIFactory; -use \OCA\News\Utility\TimeFactory; use \OCA\News\Utility\FaviconFetcher; use \OCA\News\Fetcher\Fetcher; diff --git a/appinfo/routes.php b/appinfo/routes.php index 3ca61814a..863eaa5ba 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -13,8 +13,6 @@ namespace OCA\News; -use \OCP\AppFramework\App; - use \OCA\News\AppInfo\Application; $application = new Application(); diff --git a/articleenhancer/regexarticleenhancer.php b/articleenhancer/regexarticleenhancer.php index 443562769..543eca09b 100644 --- a/articleenhancer/regexarticleenhancer.php +++ b/articleenhancer/regexarticleenhancer.php @@ -13,7 +13,6 @@ namespace OCA\News\ArticleEnhancer; -use \OCA\News\Utility\SimplePieFileFactory; use \OCA\News\Db\Item; diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php index 2499476e9..8262fc462 100644 --- a/articleenhancer/xpatharticleenhancer.php +++ b/articleenhancer/xpatharticleenhancer.php @@ -218,8 +218,8 @@ class XPathArticleEnhancer implements ArticleEnhancer { /** * Method which turns an xpath result to a string * you can customize it by overwriting this method - * @param $xpathResult the result from the xpath query - * @return the result as a string + * @param mixed $xpathResult the result from the xpath query + * @return string the result as a string */ protected function domToString($xpathResult) { $result = ""; diff --git a/config/appconfig.php b/config/appconfig.php index 456b3d2e3..e2cc01aec 100644 --- a/config/appconfig.php +++ b/config/appconfig.php @@ -13,9 +13,6 @@ namespace OCA\News\Config; -use OCP\AppFramework\IApi; -use OCP\BackgroundJob\IJob; -use OCP\BackgroundJob\IJobList; use OCP\INavigationManager; use OCP\IL10N; use OCP\IURLGenerator; @@ -111,7 +108,7 @@ class AppConfig { * Parses the navigation and creates a navigation entry if needed */ public function registerNavigation() { - // if key is missing, dont create a navigation + // if key is missing, don't create a navigation if(array_key_exists('navigation', $this->config)) { $nav =& $this->config['navigation']; @@ -162,7 +159,7 @@ class AppConfig { /** * Validates all dependencies that the app has - * @throws \OCA\News\DependencyException if one version is not satisfied + * @throws DependencyException if one version is not satisfied */ public function testDependencies() { $msg = ''; @@ -224,10 +221,11 @@ class AppConfig { * Compares a version with a version requirement string * @param string $actual the actual version that is there * @param string $required a version requirement in the form of - * <=5.3,>4.5 versions are seperated with a comma + * <=5.3,>4.5 versions are separated with a comma * @param string $versionType a description of the string that is prepended * to the error message - * @return an error message if the version is not met, empty string if ok + * @return string an error message if the version is not met, + * empty string if ok */ private function requireVersion($actual, $required, $versionType) { $requiredVersions = $this->splitVersions($required); @@ -248,9 +246,9 @@ class AppConfig { /** - * Versions can be seperated by a comma so split them + * Versions can be separated by a comma so split them * @param string $versions a version requirement in the form of - * <=5.3,>4.5 versions are seperated with a comma + * <=5.3,>4.5 versions are separated with a comma * @return array of arrays with key=version value=operator */ private function splitVersions($versions) { diff --git a/controller/entityapiserializer.php b/controller/entityapiserializer.php index 5153d9aa3..955b8db98 100644 --- a/controller/entityapiserializer.php +++ b/controller/entityapiserializer.php @@ -11,8 +11,6 @@ namespace OCA\News\Controller; -use \OCP\AppFramework\Http\Response; - use \OCA\News\Db\IAPI; diff --git a/controller/exportcontroller.php b/controller/exportcontroller.php index f5f97ee71..b455f2fcc 100644 --- a/controller/exportcontroller.php +++ b/controller/exportcontroller.php @@ -17,7 +17,6 @@ use \OCP\IRequest; use \OCP\AppFramework\Controller; use \OCP\AppFramework\Http; use \OCP\AppFramework\Http\JSONResponse; -use \OCP\AppFramework\Http\Response; use \OCA\News\Http\TextDownloadResponse; use \OCA\News\Service\FolderService; diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php index bbfcaeb56..d62e704f7 100644 --- a/controller/itemcontroller.php +++ b/controller/itemcontroller.php @@ -19,6 +19,7 @@ use \OCP\AppFramework\Controller; use \OCP\AppFramework\Http; use \OCA\News\Service\ServiceException; +use \OCA\News\Service\ServiceNotFoundException; use \OCA\News\Service\ItemService; use \OCA\News\Service\FeedService; diff --git a/controller/jsonhttperror.php b/controller/jsonhttperror.php index 9ac8704c5..a271878a8 100644 --- a/controller/jsonhttperror.php +++ b/controller/jsonhttperror.php @@ -20,7 +20,7 @@ trait JSONHttpError { /** * @param \Exception $exception the message that is returned taken from the * exception - * @param int the http error code + * @param int $code the http error code * @return \OCP\AppFramework\Http\JSONResponse */ public function error(\Exception $exception, $code) { diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index bdbbf13f0..3fa9f88b8 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -13,10 +13,10 @@ namespace OCA\News\Controller; +use OCP\AppFramework\Http\TemplateResponse; use \OCP\IRequest; use \OCP\IConfig; use \OCP\IL10N; -use \OCP\AppFramework\Http\JSONResponse; use \OCP\AppFramework\Controller; @@ -43,7 +43,7 @@ class PageController extends Controller { * @NoCSRFRequired */ public function index() { - return $this->render('main'); + return new TemplateResponse($this->appName, 'main'); } diff --git a/controller/utilityapicontroller.php b/controller/utilityapicontroller.php index 320f94747..ac23faa9e 100644 --- a/controller/utilityapicontroller.php +++ b/controller/utilityapicontroller.php @@ -17,8 +17,6 @@ use \OCP\IRequest; use \OCP\IConfig; use \OCP\AppFramework\ApiController; use \OCP\AppFramework\Http; -use \OCP\AppFramework\Http\JSONResponse; -use \OCP\AppFramework\Http\Response; use \OCA\News\Utility\Updater; diff --git a/db/feedmapper.php b/db/feedmapper.php index 21fbd1d12..dde806208 100644 --- a/db/feedmapper.php +++ b/db/feedmapper.php @@ -85,7 +85,7 @@ class FeedMapper extends Mapper implements IMapper { 'LEFT JOIN `*PREFIX*news_items` `items` ' . 'ON `feeds`.`id` = `items`.`feed_id` ' . // WARNING: this is a desperate attempt at making this query work - // because prepared statements dont work. This is a possible + // because prepared statements don't work. This is a possible // SQL INJECTION RISK WHEN MODIFIED WITHOUT THOUGHT. // think twice when changing this 'AND (`items`.`status` & ' . StatusFlag::UNREAD . ') = ' . diff --git a/db/imapper.php b/db/imapper.php index 9882060f0..18a924e24 100644 --- a/db/imapper.php +++ b/db/imapper.php @@ -20,13 +20,15 @@ interface IMapper { /** * @param int $id the id of the feed * @param string $userId the id of the user + * @return \OCP\AppFramework\Db\Entity */ public function find($id, $userId); /** * Delete an entity * @param Entity $entity the entity that should be deleted - * @throws ServiceNotFoundException if the entity does not exist, or there + * @throws \OCP\AppFramework\Db\DoesNotExistException if the entity does + * not exist, or there * are more than one of it */ public function delete(Entity $entity); diff --git a/db/itemmapper.php b/db/itemmapper.php index 477848a32..c7a0902ca 100644 --- a/db/itemmapper.php +++ b/db/itemmapper.php @@ -80,7 +80,7 @@ class ItemMapper extends Mapper implements IMapper { 'ON `items`.`feed_id` = `feeds`.`id` ' . 'AND `feeds`.`user_id` = ? ' . // WARNING: this is a desperate attempt at making this query work - // because prepared statements dont work. This is a possible + // because prepared statements don't work. This is a possible // SQL INJECTION RISK WHEN MODIFIED WITHOUT THOUGHT. // think twice when changing this 'WHERE ((`items`.`status` & ' . StatusFlag::STARRED . ') = ' . diff --git a/db/mapperfactory.php b/db/mapperfactory.php index 339ff30b8..4af75cefa 100644 --- a/db/mapperfactory.php +++ b/db/mapperfactory.php @@ -13,7 +13,6 @@ namespace OCA\News\Db; -use \OCP\IConfig; use \OCP\IDb; use \OCA\News\Db\Postgres\ItemMapper as PostgresItemMapper; diff --git a/fetcher/feedfetcher.php b/fetcher/feedfetcher.php index 81b91738e..3427331b4 100644 --- a/fetcher/feedfetcher.php +++ b/fetcher/feedfetcher.php @@ -109,7 +109,7 @@ class FeedFetcher implements IFeedFetcher { private function decodeTwice($string) { - // behold! ' is not converted by PHP thats why we need to do it + // behold! ' is not converted by PHP that's why we need to do it // manually (TM) return str_replace(''', '\'', html_entity_decode( @@ -137,7 +137,7 @@ class FeedFetcher implements IFeedFetcher { $guid = $simplePieItem->get_id(); $item->setGuid($guid); - // purification is done in the businesslayer + // purification is done in the service layer $item->setBody($simplePieItem->get_content()); // pubdate is not required. if not given use the current date diff --git a/http/textdownloadresponse.php b/http/textdownloadresponse.php index 06b331d5d..7a9d59c7d 100644 --- a/http/textdownloadresponse.php +++ b/http/textdownloadresponse.php @@ -17,7 +17,7 @@ use \OCP\AppFramework\Http\DownloadResponse; /** - * Prompts the user to download the a textfile + * Prompts the user to download the a text file */ class TextDownloadResponse extends DownloadResponse { diff --git a/service/feedservice.php b/service/feedservice.php index cc4c8770d..6c8d90033 100644 --- a/service/feedservice.php +++ b/service/feedservice.php @@ -66,7 +66,7 @@ class FeedService extends Service { /** * Finds all feeds of a user * @param string $userId the name of the user - * @return array of feeds + * @return Feed[] */ public function findAll($userId){ return $this->feedMapper->findAllFromUser($userId); @@ -103,7 +103,7 @@ class FeedService extends Service { throw new ServiceConflictException( $this->l10n->t('Can not add feed: Exists already')); - // If no matchin feed was found everything was ok + // If no matching feed was found everything was ok } catch(DoesNotExistException $ex){} // insert feed @@ -258,7 +258,7 @@ class FeedService extends Service { /** * Import articles * @param array $json the array with json - * @param string userId the username + * @param string $userId the username * @return Feed if one had to be created for nonexistent feeds */ public function importArticles($json, $userId) { @@ -275,7 +275,7 @@ class FeedService extends Service { $createdFeed = false; // loop over all items and get the corresponding feed - // if the feed does not exist, create a seperate feed for them + // if the feed does not exist, create a separate feed for them foreach ($json as $entry) { $item = Item::fromImport($entry); $item->setLastModified($this->timeFactory->getTime()); @@ -324,7 +324,7 @@ class FeedService extends Service { /** - * Use this to mark a feed as deleted. That way it can be undeleted + * 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 * @throws ServiceNotFoundException when feed does not exist diff --git a/service/folderservice.php b/service/folderservice.php index 208eace9a..5622a5260 100644 --- a/service/folderservice.php +++ b/service/folderservice.php @@ -113,7 +113,7 @@ class FolderService extends Service { /** - * Use this to mark a folder as deleted. That way it can be undeleted + * 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 * @throws ServiceNotFoundException when folder does not exist diff --git a/service/itemservice.php b/service/itemservice.php index b2ab80bc5..dcabb2f11 100644 --- a/service/itemservice.php +++ b/service/itemservice.php @@ -107,7 +107,7 @@ class ItemService extends Service { * @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 $userId the name of the user for security reasons + * @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){ @@ -131,7 +131,7 @@ 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 $userId the name of the user for security reasons + * @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){ @@ -149,7 +149,7 @@ 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 hasnt seen yet + * 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){ @@ -162,7 +162,7 @@ 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 hasnt seen yet + * 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){ @@ -175,7 +175,7 @@ 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 hasnt seen yet + * 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){ @@ -187,7 +187,7 @@ class ItemService extends Service { /** * This method deletes all unread feeds that are not starred and over the * count of $this->autoPurgeCount starting by the oldest. This is to clean - * up the database so that old entries dont spam your db. As criteria for + * up the database so that old entries don't spam your db. As criteria for * old, the id is taken */ public function autoPurgeOld(){ @@ -196,7 +196,7 @@ class ItemService extends Service { /** - * Returns the newest itemd id, use this for marking feeds read + * Returns the newest item id, use this for marking feeds read * @param string $userId the name of the user * @throws ServiceNotFoundException if there is no newest item * @return int diff --git a/service/service.php b/service/service.php index cecd33687..c4edbb9bc 100644 --- a/service/service.php +++ b/service/service.php @@ -47,7 +47,7 @@ abstract class Service { * @param string $userId the name of the user for security reasons * @throws ServiceNotFoundException if the entity does not exist, or there * are more than one of it - * @return Entity the entity + * @return \OCP\AppFramework\Db\Entity the entity */ public function find($id, $userId){ try { diff --git a/templates/main.php b/templates/main.php index 7021884e0..9185eb2f7 100644 --- a/templates/main.php +++ b/templates/main.php @@ -32,7 +32,7 @@ inc('part.listfolder')) ?> - +
inc('part.settings')) ?>
diff --git a/templates/part.addnew.php b/templates/part.addnew.php index cefc76aa6..af07dc566 100644 --- a/templates/part.addnew.php +++ b/templates/part.addnew.php @@ -20,7 +20,7 @@