ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMailOnlyExternalAddressList.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
28  protected string $installationHost;
31 
36  public function __construct(
37  ilMailAddressList $origin,
38  string $installationHost,
40  ) {
41  $this->origin = $origin;
42  $this->installationHost = $installationHost;
43  $this->getUsrIdByLoginCallable = $getUsrIdByLoginCallable;
44  }
45 
46  public function value(): array
47  {
48  $addresses = $this->origin->value();
49 
50  $filteredAddresses = array_filter($addresses, function (ilMailAddress $address): bool {
52  if ($c((string) $address)) {
53  // Fixed mantis bug #5875
54  return false;
55  }
56 
57  if ($address->getHost() === $this->installationHost) {
58  return false;
59  }
60 
61  if (strpos($address->getMailbox(), '#') === 0) {
62  return false;
63  }
64 
65  return true;
66  });
67 
68  return $filteredAddresses;
69  }
70 }
$c
Definition: cli.php:38
Class ilMailOnlyExternalAddressList.
Interface ilMailAddressList.
__construct(ilMailAddressList $origin, string $installationHost, callable $getUsrIdByLoginCallable)
Class ilMailAddress.