. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Validator; use Illuminate\Support\Collection; use Psr\Http\Message\ServerRequestInterface; /** * Autocomplete handler for surnames */ class AutoCompleteSurname extends AbstractAutocompleteHandler { /** * @param ServerRequestInterface $request * * @return Collection */ protected function search(ServerRequestInterface $request): Collection { $tree = Validator::attributes($request)->tree(); $query = $request->getQueryParams()['query'] ?? ''; return $this->search_service ->searchSurnames([$tree], [$query], 0, static::LIMIT); } }