1*22e73debSGreg Roach<?php 2*22e73debSGreg Roach 3*22e73debSGreg Roach/** 4*22e73debSGreg Roach * webtrees: online genealogy 5*22e73debSGreg Roach * Copyright (C) 2019 webtrees development team 6*22e73debSGreg Roach * This program is free software: you can redistribute it and/or modify 7*22e73debSGreg Roach * it under the terms of the GNU General Public License as published by 8*22e73debSGreg Roach * the Free Software Foundation, either version 3 of the License, or 9*22e73debSGreg Roach * (at your option) any later version. 10*22e73debSGreg Roach * This program is distributed in the hope that it will be useful, 11*22e73debSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12*22e73debSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*22e73debSGreg Roach * GNU General Public License for more details. 14*22e73debSGreg Roach * You should have received a copy of the GNU General Public License 15*22e73debSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 16*22e73debSGreg Roach */ 17*22e73debSGreg Roach 18*22e73debSGreg Roachdeclare(strict_types=1); 19*22e73debSGreg Roach 20*22e73debSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers; 21*22e73debSGreg Roach 22*22e73debSGreg Roachuse Fisharebest\Webtrees\Services\PendingChangesService; 23*22e73debSGreg Roachuse Fisharebest\Webtrees\Tree; 24*22e73debSGreg Roachuse InvalidArgumentException; 25*22e73debSGreg Roachuse Psr\Http\Message\ResponseInterface; 26*22e73debSGreg Roachuse Psr\Http\Message\ServerRequestInterface; 27*22e73debSGreg Roachuse Psr\Http\Server\RequestHandlerInterface; 28*22e73debSGreg Roach 29*22e73debSGreg Roachuse function response; 30*22e73debSGreg Roach 31*22e73debSGreg Roach/** 32*22e73debSGreg Roach * Delete pending changes. 33*22e73debSGreg Roach */ 34*22e73debSGreg Roachclass PendingChangesLogDelete implements RequestHandlerInterface 35*22e73debSGreg Roach{ 36*22e73debSGreg Roach /** @var PendingChangesService */ 37*22e73debSGreg Roach private $pending_changes_service; 38*22e73debSGreg Roach 39*22e73debSGreg Roach /** 40*22e73debSGreg Roach * @param PendingChangesService $pending_changes_service 41*22e73debSGreg Roach */ 42*22e73debSGreg Roach public function __construct(PendingChangesService $pending_changes_service) 43*22e73debSGreg Roach { 44*22e73debSGreg Roach $this->pending_changes_service = $pending_changes_service; 45*22e73debSGreg Roach } 46*22e73debSGreg Roach 47*22e73debSGreg Roach /** 48*22e73debSGreg Roach * @param ServerRequestInterface $request 49*22e73debSGreg Roach * 50*22e73debSGreg Roach * @return ResponseInterface 51*22e73debSGreg Roach */ 52*22e73debSGreg Roach public function handle(ServerRequestInterface $request): ResponseInterface 53*22e73debSGreg Roach { 54*22e73debSGreg Roach $this->pending_changes_service->changesQuery($request)->delete(); 55*22e73debSGreg Roach 56*22e73debSGreg Roach return response(); 57*22e73debSGreg Roach } 58*22e73debSGreg Roach} 59