diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2020-09-29 13:54:17 +0200 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2020-09-29 14:56:07 +0200 |
commit | 35b53ecd404a74edea3c6866e451c4819bdc9ea8 (patch) | |
tree | dac46834d8fa7ec0122243f94604c3d2215b4d22 /lib/Controller/FeedController.php | |
parent | d6d169be15913404f99b86c39a03bc71942c9f77 (diff) |
OPML export command and fixes
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'lib/Controller/FeedController.php')
-rw-r--r-- | lib/Controller/FeedController.php | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/lib/Controller/FeedController.php b/lib/Controller/FeedController.php index d0c25d55b..c09096bd9 100644 --- a/lib/Controller/FeedController.php +++ b/lib/Controller/FeedController.php @@ -15,6 +15,7 @@ namespace OCA\News\Controller; use OCA\News\Service\Exceptions\ServiceConflictException; use OCA\News\Service\Exceptions\ServiceNotFoundException; +use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; use OCP\IConfig; use OCP\AppFramework\Controller; @@ -36,13 +37,13 @@ class FeedController extends Controller private $settings; public function __construct( - $appName, + string $appName, IRequest $request, FolderService $folderService, FeedService $feedService, ItemService $itemService, IConfig $settings, - $UserId + string $UserId ) { parent::__construct($appName, $request); $this->feedService = $feedService; @@ -56,7 +57,7 @@ class FeedController extends Controller /** * @NoAdminRequired */ - public function index() + public function index(): array { // this method is also used to update the interface @@ -83,7 +84,7 @@ class FeedController extends Controller /** * @NoAdminRequired */ - public function active() + public function active(): array { $feedId = (int) $this->settings->getUserValue( $this->userId, @@ -134,14 +135,15 @@ class FeedController extends Controller * @param string $title * @param string $user * @param string $password - * @return array|\OCP\AppFramework\Http\JSONResponse + * + * @return array|JSONResponse */ public function create( - $url, - $parentFolderId, - $title = null, - $user = null, - $password = null + string $url, + int $parentFolderId, + ?string $title = null, + ?string $user = null, + ?string $password = null ) { try { // we need to purge deleted feeds if a feed is created to @@ -180,9 +182,10 @@ class FeedController extends Controller * @NoAdminRequired * * @param int $feedId - * @return array|\OCP\AppFramework\Http\JSONResponse + * + * @return array|JSONResponse */ - public function delete($feedId) + public function delete(int $feedId) { try { $this->feedService->markDeleted($feedId, $this->userId); @@ -198,9 +201,10 @@ class FeedController extends Controller * @NoAdminRequired * * @param int $feedId - * @return array|\OCP\AppFramework\Http\JSONResponse + * + * @return array|JSONResponse */ - public function update($feedId) + public function update(int $feedId) { try { $feed = $this->feedService->update($this->userId, $feedId); @@ -227,7 +231,7 @@ class FeedController extends Controller * @param array $json * @return array */ - public function import($json) + public function import(array $json): array { $feed = $this->feedService->importArticles($json, $this->userId); @@ -250,7 +254,7 @@ class FeedController extends Controller * @param int $highestItemId * @return array */ - public function read($feedId, $highestItemId) + public function read(int $feedId, int $highestItemId): array { $this->itemService->readFeed($feedId, $highestItemId, $this->userId); @@ -269,9 +273,10 @@ class FeedController extends Controller * @NoAdminRequired * * @param int $feedId - * @return array|\OCP\AppFramework\Http\JSONResponse + * + * @return array|JSONResponse */ - public function restore($feedId) + public function restore(int $feedId) { try { $this->feedService->unmarkDeleted($feedId, $this->userId); @@ -292,15 +297,17 @@ class FeedController extends Controller * @param int $ordering * @param int $folderId * @param string $title + * + * @return array|JSONResponse */ public function patch( - $feedId, - $pinned = null, - $fullTextEnabled = null, - $updateMode = null, - $ordering = null, - $title = null, - $folderId = null + int $feedId, + ?bool $pinned = null, + ?bool $fullTextEnabled = null, + ?int $updateMode = null, + ?int $ordering = null, + ?int $folderId = null, + ?string $title = null ) { $attributes = [ 'pinned' => $pinned, |