. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Tree; use InvalidArgumentException; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use function assert; /** * Search for genealogy data */ class SearchPhoneticAction implements RequestHandlerInterface { /** * The standard search. * * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $tree = $request->getAttribute('tree'); assert($tree instanceof Tree, new InvalidArgumentException()); $params = $request->getParsedBody(); return redirect(route(SearchPhoneticPage::class, [ 'firstname' => $params['firstname'] ?? '', 'lastname' => $params['lastname'] ?? '', 'place' => $params['place'] ?? '', 'soundex' => $params['soundex'] ?? 'Russell', 'tree' => $tree->name(), ])); } }