19declare(strict_types=1);
39 private readonly FieldConfigurationRepository $field_configuration_repository,
40 private readonly ProfileDataRepository $profile_data_repository,
41 private readonly SettingsDataRepository $settings_data_repository,
42 private readonly \
ilObjUser $current_user,
43 private readonly HttpService
$http,
45 private readonly \
ilCtrl $ctrl,
46 private readonly DataFactory $data_factory,
57 $this->data_factory->uri(
58 ILIAS_HTTP_PATH .
'/' . $this->ctrl->getLinkTargetByClass(
60 $this->endpoint_configurator->getParentClassPath(),
65 ))->acquireParameter(self::NAMESPACE, self::SEARCH_TERM_TOKEN);
75 $this->
http->saveResponse(
76 $this->
http->response()->withBody(
80 $this->
http->sendResponse();
84 private function buildResponse(): string
93 $autocomplete_query = $this->
http->wrapper()->query()->retrieve(
95 $this->refinery->byTrying([
96 $this->refinery->custom()->transformation(
97 $this->buildQueryStringTransformation()
99 $this->refinery->always(
null)
104 static fn(AutocompleteItem $v) => $v->getTagArray(),
106 $this->endpoint_configurator->getAdditionalAnswerElements(
110 $this->profile_data_repository->searchUsers(
111 $this->settings_data_repository,
112 $this->field_configuration_repository,
120 fn(array
$a, array
$b):
int =>
$a[
'display'] <=>
$b[
'display']
131 $this->
refinery->kindlyTo()->string()->transform($parameter)
Stream factory which enables the user to create streams without the knowledge of the concrete class.
static ofString(string $string)
Creates a new stream with an initial value.
This class provides some pre-processing for search terms provided by a user when searching for users.
__construct(private readonly FieldConfigurationRepository $field_configuration_repository, private readonly ProfileDataRepository $profile_data_repository, private readonly SettingsDataRepository $settings_data_repository, private readonly \ilObjUser $current_user, private readonly HttpService $http, private readonly Refinery $refinery, private readonly \ilCtrl $ctrl, private readonly DataFactory $data_factory, private readonly EndpointConfigurator $endpoint_configurator)
const int SUGGESTIONS_START_AFTER
buildQueryStringTransformation()
getSuggestionsStartAfter()
const string SEARCH_TERM_TOKEN
Class ilCtrl provides processing control methods.
static http()
Fetches the global http state from ILIAS.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples