1208909d8SGreg Roach<?php 2208909d8SGreg Roach 3208909d8SGreg Roach/** 4208909d8SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6208909d8SGreg Roach * This program is free software: you can redistribute it and/or modify 7208909d8SGreg Roach * it under the terms of the GNU General Public License as published by 8208909d8SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9208909d8SGreg Roach * (at your option) any later version. 10208909d8SGreg Roach * This program is distributed in the hope that it will be useful, 11208909d8SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12208909d8SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13208909d8SGreg Roach * GNU General Public License for more details. 14208909d8SGreg Roach * You should have received a copy of the GNU General Public License 15208909d8SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16208909d8SGreg Roach */ 17208909d8SGreg Roach 18208909d8SGreg Roachdeclare(strict_types=1); 19208909d8SGreg Roach 20208909d8SGreg Roachnamespace Fisharebest\Webtrees\Contracts; 21208909d8SGreg Roach 22208909d8SGreg Roachuse Fig\Http\Message\StatusCodeInterface; 23208909d8SGreg Roachuse Fisharebest\Webtrees\Webtrees; 24208909d8SGreg Roachuse Psr\Http\Message\ResponseInterface; 25208909d8SGreg Roachuse Psr\Http\Message\UriInterface; 26208909d8SGreg Roach 27208909d8SGreg Roach/** 28208909d8SGreg Roach * ake a PSR-7 response (using a PSR-17 response factory). 29208909d8SGreg Roach */ 30208909d8SGreg Roachinterface ResponseFactoryInterface 31208909d8SGreg Roach{ 32208909d8SGreg Roach /** 33208909d8SGreg Roach * Redirect to a named route. 34208909d8SGreg Roach * 35208909d8SGreg Roach * @param string $route_name 36208909d8SGreg Roach * @param array<bool|int|string|array<string>|null> $parameters 37208909d8SGreg Roach * @param int $status 38208909d8SGreg Roach * 39208909d8SGreg Roach * @return ResponseInterface 40208909d8SGreg Roach * 41208909d8SGreg Roach */ 42208909d8SGreg Roach public function redirect( 43208909d8SGreg Roach string $route_name, 44208909d8SGreg Roach array $parameters = [], 45208909d8SGreg Roach int $status = StatusCodeInterface::STATUS_FOUND 46208909d8SGreg Roach ): ResponseInterface; 47208909d8SGreg Roach 48208909d8SGreg Roach /** 49208909d8SGreg Roach * Redirect to a URL. 50208909d8SGreg Roach * 51ac71572dSGreg Roach * @param UriInterface|string $url 52208909d8SGreg Roach * @param int $code 53208909d8SGreg Roach * 54208909d8SGreg Roach * @return ResponseInterface 55208909d8SGreg Roach */ 56ac71572dSGreg Roach public function redirectUrl(UriInterface|string $url, int $code = StatusCodeInterface::STATUS_FOUND): ResponseInterface; 57208909d8SGreg Roach 58208909d8SGreg Roach /** 59208909d8SGreg Roach * @param string|array<mixed>|object $content 60208909d8SGreg Roach * @param int $code 61208909d8SGreg Roach * @param array<string,string> $headers 62208909d8SGreg Roach * 63208909d8SGreg Roach * @return ResponseInterface 64208909d8SGreg Roach */ 65ac71572dSGreg Roach public function response(string|array|object $content = '', int $code = StatusCodeInterface::STATUS_OK, array $headers = []): ResponseInterface; 66208909d8SGreg Roach 67208909d8SGreg Roach /** 68208909d8SGreg Roach * Create and render a view, and embed it in an HTML page. 69208909d8SGreg Roach * 70208909d8SGreg Roach * @param string $view_name 7124f79581SGreg Roach * @param array<string,mixed> $view_data 72208909d8SGreg Roach * @param int $status 73208909d8SGreg Roach * @param string $layout_name 74208909d8SGreg Roach * 75208909d8SGreg Roach * @return ResponseInterface 76208909d8SGreg Roach */ 77208909d8SGreg Roach public function view( 78208909d8SGreg Roach string $view_name, 79208909d8SGreg Roach array $view_data, 80208909d8SGreg Roach int $status = StatusCodeInterface::STATUS_OK, 81208909d8SGreg Roach string $layout_name = Webtrees::LAYOUT_DEFAULT 82208909d8SGreg Roach ): ResponseInterface; 83208909d8SGreg Roach} 84