. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\StatusCodeInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use function assert; use function is_string; use function redirect; use function route; /** * Redirect URLs created by webtrees 1.x (and PhpGedView). */ class RedirectMediaViewerPhp implements RequestHandlerInterface { /** * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $tree = $request->getQueryParams()['ged']; assert(is_string($tree)); $xref = $request->getQueryParams()['mid']; assert(is_string($xref)); $route = route('media', ['tree' => $tree, 'xref' => $xref]); return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY); } }