19 declare(strict_types=1);
31 protected int $mode = self::MODE_STOP_ON_MAX_ENTRIES;
36 'hasMoreResults' => false
43 $this->allow_smtp = $DIC->rbac()->system()->checkAccess(
'smtp_mail',
MAIL_SETTINGS_ID);
44 $this->user_id = $DIC->user()->getId();
55 if (!in_array($mode, [self::MODE_FETCH_ALL, self::MODE_STOP_ON_MAX_ENTRIES],
true)) {
63 if ($this->mode === self::MODE_STOP_ON_MAX_ENTRIES &&
64 $this->max_entries >= 0 && count($this->result[
'items']) >= $this->max_entries) {
68 if ($this->mode === self::MODE_FETCH_ALL &&
69 count($this->result[
'items']) >= self::MAX_RESULT_ENTRIES) {
76 public function addResult(
string $login,
string $firstname,
string $lastname): void
78 if ($login !==
'' && !isset($this->handled_recipients[$login])) {
80 $recipient[
'value'] = $login;
83 if ($firstname && $lastname) {
84 $label .=
" [" . $firstname .
", " . $lastname .
"]";
86 $recipient[
'label'] = $label;
88 $this->result[
'items'][] = $recipient;
89 $this->handled_recipients[$login] = 1;
103 return count($this->result[
'items']);
addResult(string $login, string $firstname, string $lastname)
final const int MODE_STOP_ON_MAX_ENTRIES
final const int MODE_FETCH_ALL
array $handled_recipients
array __construct(int $mode)
final const int MAX_RESULT_ENTRIES