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