1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-08-20 07:49:51 +02:00
Files
.github
.tx
appinfo
bin
css
docs
img
js
l10n
lib
AppInfo
Command
Config
FeedAdd.php
FeedDelete.php
FeedList.php
FolderAdd.php
FolderDelete.php
FolderList.php
OpmlExport.php
Debug
Updater
ExploreGenerator.php
ShowFeed.php
Config
Controller
Cron
Db
Explore
Fetcher
Hooks
Migration
Plugin
Scraper
Search
Service
Settings
Utility
screenshots
templates
tests
.editorconfig
.gitignore
.mailmap
AUTHORS.md
CHANGELOG.md
CONTRIBUTING.md
COPYING
Makefile
README.md
composer.json
composer.lock
mkdocs.yml
phpstan.neon.dist
phpunit.xml
Sean Molenaar 67b6c4e1b0 Fix psalm issues
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
2021-01-12 13:29:08 +01:00

56 lines
1.3 KiB
PHP

<?php
namespace OCA\News\Command\Config;
use OCA\News\Service\FeedServiceV2;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class FeedDelete extends Command
{
/**
* @var FeedServiceV2 service for the feeds.
*/
protected $feedService;
public function __construct(FeedServiceV2 $feedService)
{
parent::__construct(null);
$this->feedService = $feedService;
}
/**
* Configure command
*
* @return void
*/
protected function configure()
{
$this->setName('news:feed:delete')
->setDescription('Remove a feed')
->addArgument('user-id', InputArgument::REQUIRED, 'User to remove the feed from')
->addArgument('feed-id', InputArgument::REQUIRED, 'Feed ID', null);
}
/**
* Execute command
*
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$user = $input->getArgument('user-id');
$id = (int) $input->getArgument('feed-id');
$this->feedService->delete($user, $id);
return 0;
}
}