19declare(strict_types=1);
42 'hasMoreResults' => false
57 if (!\in_array(
$mode, [self::MODE_FETCH_ALL, self::MODE_STOP_ON_MAX_ENTRIES],
true)) {
58 throw new \InvalidArgumentException(
'Wrong mode passed!');
65 if ($this->mode === self::MODE_STOP_ON_MAX_ENTRIES &&
66 $this->max_entries >= 0 && \count($this->result[
'items']) >= $this->max_entries) {
70 if ($this->mode === self::MODE_FETCH_ALL &&
71 \count($this->result[
'items']) >= self::MAX_RESULT_ENTRIES) {
80 $this->result[
'hasMoreResults'] =
true;
86 throw new \DomainException(
'Search result is not addable!');
89 if ($identifier ===
'') {
90 return SearchResultStatus::IGNORED;
93 if (!isset($this->handled_recipients[$identifier])) {
95 $recipient[
'value'] = $identifier;
98 if ($firstname && $lastname) {
99 $label .=
' [' . $firstname .
', ' . $lastname .
']';
101 $recipient[
'label'] = $label;
103 $this->result[
'items'][] = $recipient;
104 $this->handled_recipients[$identifier] =
true;
111 return SearchResultStatus::DUPLICATE;
@phpstan-type AutoCompleteUserItem array{label: string, value: string} @phpstan-type AutoCompleteResu...
array $handled_recipients
addResult(string $identifier, string $firstname, string $lastname)
final const int MAX_RESULT_ENTRIES
final const int MODE_FETCH_ALL
final const int MODE_STOP_ON_MAX_ENTRIES
markMoreResultsAvailable()