diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-06-25 11:22:08 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-06-25 11:22:08 +0200 |
commit | 06367d8b81407fc2948e0f666b38f4de2dffbd89 (patch) | |
tree | d5cfb74e70560f3abce5aeccf8994dcbe2829e24 | |
parent | 60c4dfbd9661b93bce14a6a429a3f23d19b5327c (diff) |
style fixes
-rw-r--r-- | appinfo/app.php | 4 | ||||
-rw-r--r-- | appinfo/application.php | 6 | ||||
-rw-r--r-- | articleenhancer/enhancer.php | 7 | ||||
-rw-r--r-- | articleenhancer/xpatharticleenhancer.php | 17 | ||||
-rw-r--r-- | config/appconfig.php | 6 | ||||
-rw-r--r-- | controller/entityapiserializer.php | 4 | ||||
-rw-r--r-- | controller/feedapicontroller.php | 73 | ||||
-rw-r--r-- | controller/feedcontroller.php | 108 | ||||
-rw-r--r-- | controller/folderapicontroller.php | 49 | ||||
-rw-r--r-- | controller/foldercontroller.php | 79 | ||||
-rw-r--r-- | controller/itemapicontroller.php | 120 | ||||
-rw-r--r-- | controller/itemcontroller.php | 75 | ||||
-rw-r--r-- | controller/jsonhttperror.php | 2 | ||||
-rw-r--r-- | db/feed.php | 2 | ||||
-rw-r--r-- | db/item.php | 5 | ||||
-rw-r--r-- | db/mapperfactory.php | 4 | ||||
-rw-r--r-- | fetcher/fetcher.php | 2 | ||||
-rw-r--r-- | service/feedservice.php | 5 | ||||
-rw-r--r-- | service/itemservice.php | 1 | ||||
-rw-r--r-- | templates/part.content.php | 2 | ||||
-rw-r--r-- | templates/part.items.php | 4 |
21 files changed, 324 insertions, 251 deletions
diff --git a/appinfo/app.php b/appinfo/app.php index e50525a5c..cacd0637d 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -13,6 +13,8 @@ namespace OCA\News\AppInfo; +use \OCA\News\Config\DependencyException; + $container = new Application(); $config = $container->getAppConfig(); @@ -24,7 +26,7 @@ $config->registerHooks(); // check for correct app dependencies try { $config->testDependencies(); -} catch(\OCA\News\Config\DependencyException $e) { +} catch(DependencyException $e) { $logger = $container->getLogger(); $params = $container->getLoggerParameters(); $logger->emergency($e->getMessage(), $params); diff --git a/appinfo/application.php b/appinfo/application.php index d2e846ded..ddc3cb903 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -15,6 +15,8 @@ namespace OCA\News\AppInfo; use \OC\Files\View; use \OCP\AppFramework\App; +use \OCP\Util; +use \OCP\User; use \OCA\News\Config\AppConfig; @@ -260,7 +262,7 @@ class Application extends App { $c->query('L10N'), $c->query('ServerContainer')->getURLGenerator(), phpversion(), - implode('.', \OCP\Util::getVersion()), + implode('.', Util::getVersion()), $apps, $extensions, $c->query('DatabaseType') @@ -275,7 +277,7 @@ class Application extends App { }); $container->registerService('UserId', function() { - return \OCP\User::getUser(); + return User::getUser(); }); $container->registerService('Logger', function($c) { diff --git a/articleenhancer/enhancer.php b/articleenhancer/enhancer.php index f9b4d5d64..9aa2153d1 100644 --- a/articleenhancer/enhancer.php +++ b/articleenhancer/enhancer.php @@ -50,9 +50,10 @@ class Enhancer { } - /** - * @param string $url - */ + /** + * @param string $url + * @return string + */ private function removeTrailingSlash($url) { if($url[strlen($url)-1] === '/') { return substr($url, 0, -1); diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php index ecde135bf..2499476e9 100644 --- a/articleenhancer/xpatharticleenhancer.php +++ b/articleenhancer/xpatharticleenhancer.php @@ -21,20 +21,21 @@ use \OCA\News\Utility\Config; class XPathArticleEnhancer implements ArticleEnhancer { - private $feedRegex; private $fileFactory; private $maximumTimeout; private $config; private $regexXPathPair; - /** - * @param SimplePieFileFactory a factory for getting a simple pie file instance - * @param array $regexXPathPair an associative array containing regex to - * match the url and the xpath that should be used for it to extract the - * page - * @param int $maximumTimeout maximum timeout in seconds, defaults to 10 sec - */ + /** + * @param \OCA\News\Utility\SimplePieAPIFactory $fileFactory + * @param array $regexXPathPair an associative array containing regex to + * match the url and the xpath that should be used for it to extract the + * page + * @param \OCA\News\Utility\Config $config + * @internal param \OCA\News\ArticleEnhancer\a $SimplePieFileFactory factory for getting a simple pie file instance + * @internal param int $maximumTimeout maximum timeout in seconds, defaults to 10 sec + */ public function __construct(SimplePieAPIFactory $fileFactory, array $regexXPathPair, Config $config){ $this->regexXPathPair = $regexXPathPair; diff --git a/config/appconfig.php b/config/appconfig.php index 4315569d6..456b3d2e3 100644 --- a/config/appconfig.php +++ b/config/appconfig.php @@ -19,6 +19,8 @@ use OCP\BackgroundJob\IJobList; use OCP\INavigationManager; use OCP\IL10N; use OCP\IURLGenerator; +use \OCP\Backgroundjob; +use \OCP\Util; // Used to parse app.json file, should be in core at some point @@ -136,7 +138,7 @@ class AppConfig { // FIXME: this is temporarily static because core jobs are not public // yet, therefore legacy code foreach ($this->config['jobs'] as $job) { - \OCP\Backgroundjob::addRegularTask($job, 'run'); + Backgroundjob::addRegularTask($job, 'run'); } } @@ -152,7 +154,7 @@ class AppConfig { $reaction = explode('::', $react); // config is written like HookNamespace::method => Class::method - \OCP\Util::connectHook($listener[0], $listener[1], $reaction[0], + Util::connectHook($listener[0], $listener[1], $reaction[0], $reaction[1]); } } diff --git a/controller/entityapiserializer.php b/controller/entityapiserializer.php index eb60bc7c5..5153d9aa3 100644 --- a/controller/entityapiserializer.php +++ b/controller/entityapiserializer.php @@ -26,11 +26,13 @@ class EntityApiSerializer { /** * Call toAPI() method on all entities. Works on - * @param mixed $data: + * + * @param mixed $data : * * Entity * * Entity[] * * array('level' => Entity[]) * * Response + * @return array|mixed */ public function serialize($data) { diff --git a/controller/feedapicontroller.php b/controller/feedapicontroller.php index 4ba3b9be5..f0af19f4a 100644 --- a/controller/feedapicontroller.php +++ b/controller/feedapicontroller.php @@ -60,7 +60,6 @@ class FeedApiController extends ApiController { public function index() { $result = [ - 'feeds' => [], 'starredCount' => $this->itemService->starredCount($this->userId), 'feeds' => $this->feedService->findAll($this->userId) ]; @@ -76,14 +75,15 @@ class FeedApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param string $url - * @param int $folderId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param string $url + * @param int $folderId + * @return array|mixed|\OCP\AppFramework\Http\JSONResponse + */ public function create($url, $folderId=0) { try { $this->feedService->purgeDeleted($this->userId, false); @@ -107,19 +107,22 @@ class FeedApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function delete($feedId) { try { $this->feedService->delete($feedId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } @@ -136,37 +139,43 @@ class FeedApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - * @param int $folderId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @param int $folderId + * @return \OCP\AppFramework\Http\JSONResponse + */ public function move($feedId, $folderId) { try { $this->feedService->move($feedId, $folderId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - * @param string $feedTitle - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @param string $feedTitle + * @return \OCP\AppFramework\Http\JSONResponse + */ public function rename($feedId, $feedTitle) { try { $this->feedService->rename($feedId, $feedTitle, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php index 3b9ab5cf9..d62b05c45 100644 --- a/controller/feedcontroller.php +++ b/controller/feedcontroller.php @@ -118,13 +118,14 @@ class FeedController extends Controller { } - /** - * @NoAdminRequired - * - * @param string $url - * @param int $parentFolderId - * @param string $title - */ + /** + * @NoAdminRequired + * + * @param string $url + * @param int $parentFolderId + * @param string $title + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function create($url, $parentFolderId, $title){ try { // we need to purge deleted feeds if a feed is created to @@ -150,28 +151,33 @@ class FeedController extends Controller { } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY); } + } - /** - * @NoAdminRequired - * - * @param int $feedId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @return \OCP\AppFramework\Http\JSONResponse + */ public function delete($feedId){ try { $this->feedService->markDeleted($feedId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param int $feedId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function update($feedId){ try { $feed = $this->feedService->update($feedId, $this->userId); @@ -190,43 +196,51 @@ class FeedController extends Controller { } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + } - /** - * @NoAdminRequired - * - * @param int $feedId - * @param int $parentFolderId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @param int $parentFolderId + * @return \OCP\AppFramework\Http\JSONResponse + */ public function move($feedId, $parentFolderId){ try { $this->feedService->move($feedId, $parentFolderId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param int $feedId - * @param string $feedTitle - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @param string $feedTitle + * @return \OCP\AppFramework\Http\JSONResponse + */ public function rename($feedId, $feedTitle) { try { $this->feedService->rename($feedId, $feedTitle, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param array $json - */ + /** + * @NoAdminRequired + * + * @param array $json + * @return array + */ public function import($json) { $feed = $this->feedService->importArticles($json, $this->userId); @@ -240,12 +254,13 @@ class FeedController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $feedId - * @param int $highestItemId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @param int $highestItemId + * @return array + */ public function read($feedId, $highestItemId){ $this->itemService->readFeed($feedId, $highestItemId, $this->userId); @@ -260,17 +275,20 @@ class FeedController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $feedId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @return \OCP\AppFramework\Http\JSONResponse + */ public function restore($feedId){ try { $this->feedService->unmarkDeleted($feedId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } diff --git a/controller/folderapicontroller.php b/controller/folderapicontroller.php index 666f4cfa2..84f1dbdf5 100644 --- a/controller/folderapicontroller.php +++ b/controller/folderapicontroller.php @@ -58,13 +58,14 @@ class FolderApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param string $name - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param string $name + * @return array|mixed|\OCP\AppFramework\Http\JSONResponse + */ public function create($name) { try { $this->folderService->purgeDeleted($this->userId, false); @@ -79,29 +80,33 @@ class FolderApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $folderId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $folderId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function delete($folderId) { try { $this->folderService->delete($folderId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * @param int $folderId - * @param string $name - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * @param int $folderId + * @param string $name + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function update($folderId, $name) { try { $this->folderService->rename($folderId, $name, $this->userId); @@ -113,6 +118,8 @@ class FolderApiController extends ApiController { } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } diff --git a/controller/foldercontroller.php b/controller/foldercontroller.php index 576fee422..9488a7d6c 100644 --- a/controller/foldercontroller.php +++ b/controller/foldercontroller.php @@ -57,26 +57,30 @@ class FolderController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $folderId - * @param bool $open - */ + /** + * @NoAdminRequired + * + * @param int $folderId + * @param bool $open + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function open($folderId, $open) { try { $this->folderService->open($folderId, $open, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param string $folderName - */ + /** + * @NoAdminRequired + * + * @param string $folderName + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function create($folderName) { try { // we need to purge deleted folders if a folder is created to @@ -95,26 +99,30 @@ class FolderController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $folderId - */ + /** + * @NoAdminRequired + * + * @param int $folderId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function delete($folderId) { try { $this->folderService->markDeleted($folderId, $this->userId); } catch (ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param string $folderName - * @param int $folderId - */ + /** + * @NoAdminRequired + * + * @param string $folderName + * @param int $folderId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function rename($folderName, $folderId) { try { $folder = $this->folderService->rename($folderId, $folderName, @@ -129,14 +137,16 @@ class FolderController extends Controller { } catch (ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + } - /** - * @NoAdminRequired - * - * @param int $folderId - * @param int $highestItemId - */ + /** + * @NoAdminRequired + * + * @param int $folderId + * @param int $highestItemId + * @return array + */ public function read($folderId, $highestItemId) { $this->itemService->readFolder($folderId, $highestItemId, $this->userId); @@ -144,17 +154,20 @@ class FolderController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $folderId - */ + /** + * @NoAdminRequired + * + * @param int $folderId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function restore($folderId) { try { $this->folderService->unmarkDeleted($folderId, $this->userId); } catch (ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } diff --git a/controller/itemapicontroller.php b/controller/itemapicontroller.php index 40366a936..ff66de951 100644 --- a/controller/itemapicontroller.php +++ b/controller/itemapicontroller.php @@ -39,18 +39,19 @@ class ItemApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $type - * @param int $id - * @param bool $getRead - * @param int $batchSize - * @param int $offset - * @param int $oldestFirst - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $type + * @param int $id + * @param bool $getRead + * @param int $batchSize + * @param int $offset + * @param bool $oldestFirst + * @return array|mixed + */ public function index($type, $id, $getRead, $batchSize=20, $offset=0, $oldestFirst=false) { return $this->serializer->serialize( @@ -62,15 +63,16 @@ class ItemApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $type - * @param int $id - * @param int $lastModified - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $type + * @param int $id + * @param int $lastModified + * @return array|mixed + */ public function updated($type, $id, $lastModified=0) { return $this->serializer->serialize( $this->itemService->findAllNew($id, $type, $lastModified, @@ -85,28 +87,32 @@ class ItemApiController extends ApiController { } catch(ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $itemId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $itemId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function read($itemId) { return $this->setRead(true, $itemId); } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $itemId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $itemId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function unread($itemId) { return $this->setRead(false, $itemId); } @@ -118,30 +124,34 @@ class ItemApiController extends ApiController { } catch(ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - * @param string $guidHash - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @param string $guidHash + * @return \OCP\AppFramework\Http\JSONResponse + */ public function star($feedId, $guidHash) { return $this->setStarred(true, $feedId, $guidHash); } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - * @param string $guidHash - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @param string $guidHash + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function unstar($feedId, $guidHash) { return $this->setStarred(false, $feedId, $guidHash); } @@ -178,7 +188,7 @@ class ItemApiController extends ApiController { * @param int[] item ids */ public function readMultiple($items) { - return $this->setMultipleRead(true, $items); + $this->setMultipleRead(true, $items); } @@ -190,7 +200,7 @@ class ItemApiController extends ApiController { * @param int[] item ids */ public function unreadMultiple($items) { - return $this->setMultipleRead(false, $items); + $this->setMultipleRead(false, $items); } @@ -214,7 +224,7 @@ class ItemApiController extends ApiController { * @param int[] item ids */ public function starMultiple($items) { - return $this->setMultipleStarred(true, $items); + $this->setMultipleStarred(true, $items); } @@ -226,7 +236,7 @@ class ItemApiController extends ApiController { * @param int[] item ids */ public function unstarMultiple($items) { - return $this->setMultipleStarred(false, $items); + $this->setMultipleStarred(false, $items); } diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php index 30677d9fc..bbfcaeb56 100644 --- a/controller/itemcontroller.php +++ b/controller/itemcontroller.php @@ -46,14 +46,15 @@ class ItemController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $type - * @param int $id - * @param int $limit - * @param int $offset - */ + /** + * @NoAdminRequired + * + * @param int $type + * @param int $id + * @param int $limit + * @param int $offset + * @retu |