1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- declare(strict_types=1);
- namespace Shlinkio\Shlink\Rest\Action\Tag;
- use Laminas\Diactoros\Response\EmptyResponse;
- use Psr\Http\Message\ResponseInterface;
- use Psr\Http\Message\ServerRequestInterface;
- use Psr\Log\LoggerInterface;
- use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface;
- use Shlinkio\Shlink\Rest\Action\AbstractRestAction;
- class DeleteTagsAction extends AbstractRestAction
- {
- protected const ROUTE_PATH = '/tags';
- protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE];
- private TagServiceInterface $tagService;
- public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null)
- {
- parent::__construct($logger);
- $this->tagService = $tagService;
- }
- /**
- * Process an incoming server request and return a response, optionally delegating
- * to the next middleware component to create the response.
- *
- *
- */
- public function handle(ServerRequestInterface $request): ResponseInterface
- {
- $query = $request->getQueryParams();
- $tags = $query['tags'] ?? [];
- $this->tagService->deleteTags($tags);
- return new EmptyResponse();
- }
- }
|