ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilMailAddressTypeFactory Class Reference
+ Collaboration diagram for ilMailAddressTypeFactory:

Public Member Functions

 __construct (?ilGroupNameAsMailValidator $group_name_validator=null, ?ilLogger $logger=null, ?ilRbacSystem $rbacsystem=null, ?ilRbacReview $rbacreview=null, ?ilMailAddressTypeHelper $type_helper=null, ?ilMailingLists $lists=null, ?ilRoleMailboxSearch $role_mailbox_search=null)
 
 getByPrefix (ilMailAddress $address, bool $cached=true)
 

Protected Attributes

ilRbacSystem $rbacsystem
 
ilRbacReview $rbacreview
 
ilMailAddressTypeHelper $type_helper
 
ilMailingLists $lists
 
ilRoleMailboxSearch $role_mailbox_search
 

Private Attributes

readonly ilGroupNameAsMailValidator $group_name_validator
 
readonly ilLogger $logger
 

Detailed Description

Definition at line 21 of file class.ilMailAddressTypeFactory.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailAddressTypeFactory::__construct ( ?ilGroupNameAsMailValidator  $group_name_validator = null,
?ilLogger  $logger = null,
?ilRbacSystem  $rbacsystem = null,
?ilRbacReview  $rbacreview = null,
?ilMailAddressTypeHelper  $type_helper = null,
?ilMailingLists  $lists = null,
?ilRoleMailboxSearch  $role_mailbox_search = null 
)

Definition at line 31 of file class.ilMailAddressTypeFactory.php.

References $DIC, ilLoggerFactory\getLogger(), ilMail\ILIAS_HOST, and ILIAS\Repository\logger().

39  {
40  global $DIC;
41 
42  $this->group_name_validator = $group_name_validator ?? new ilGroupNameAsMailValidator(ilMail::ILIAS_HOST);
43  $this->logger = $logger ?? ilLoggerFactory::getLogger('mail');
44  $this->type_helper = $type_helper ?? new ilMailAddressTypeHelperImpl(ilMail::ILIAS_HOST);
45  $this->rbacsystem = $rbacsystem ?? $DIC->rbac()->system();
46  $this->rbacreview = $rbacreview ?? $DIC->rbac()->review();
47  $this->lists = $lists ?? new ilMailingLists($DIC->user());
48  $this->role_mailbox_search = $role_mailbox_search ?? new ilRoleMailboxSearch(
50  $DIC->database()
51  );
52  }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: shib_login.php:26
const string ILIAS_HOST
readonly ilGroupNameAsMailValidator $group_name_validator
+ Here is the call graph for this function:

Member Function Documentation

◆ getByPrefix()

ilMailAddressTypeFactory::getByPrefix ( ilMailAddress  $address,
bool  $cached = true 
)

Definition at line 54 of file class.ilMailAddressTypeFactory.php.

References ilMailAddress\getMailbox(), ILIAS\Repository\logger(), and ilBaseMailAddressType\validate().

55  {
56  $address_type = match (true) {
57  str_starts_with($address->getMailbox(), '#il_ml_') => new ilMailMailingListAddressType(
58  $this->type_helper,
59  $address,
60  $this->logger,
61  $this->lists
62  ),
63  !str_starts_with($address->getMailbox(), '#') && !str_starts_with(
64  $address->getMailbox(),
65  '"#'
67  $this->type_helper,
68  $address,
69  $this->logger,
70  $this->rbacsystem
71  ),
72  $this->group_name_validator->validate($address) => new ilMailGroupAddressType(
73  $this->type_helper,
74  $address,
75  $this->logger
76  ),
77  default => new ilMailRoleAddressType(
78  $this->type_helper,
79  $address,
80  $this->role_mailbox_search,
81  $this->logger,
82  $this->rbacsystem,
83  $this->rbacreview
84  ),
85  };
86 
87  return new ilMailCachedAddressType($address_type, $cached);
88  }
validate(int $sender_id)
Validates the parsed recipients and set errors accordingly.
+ Here is the call graph for this function:

Field Documentation

◆ $group_name_validator

readonly ilGroupNameAsMailValidator ilMailAddressTypeFactory::$group_name_validator
private

Definition at line 23 of file class.ilMailAddressTypeFactory.php.

◆ $lists

ilMailingLists ilMailAddressTypeFactory::$lists
protected

Definition at line 28 of file class.ilMailAddressTypeFactory.php.

◆ $logger

readonly ilLogger ilMailAddressTypeFactory::$logger
private

Definition at line 24 of file class.ilMailAddressTypeFactory.php.

◆ $rbacreview

ilRbacReview ilMailAddressTypeFactory::$rbacreview
protected

Definition at line 26 of file class.ilMailAddressTypeFactory.php.

◆ $rbacsystem

ilRbacSystem ilMailAddressTypeFactory::$rbacsystem
protected

Definition at line 25 of file class.ilMailAddressTypeFactory.php.

◆ $role_mailbox_search

ilRoleMailboxSearch ilMailAddressTypeFactory::$role_mailbox_search
protected

Definition at line 29 of file class.ilMailAddressTypeFactory.php.

◆ $type_helper

ilMailAddressTypeHelper ilMailAddressTypeFactory::$type_helper
protected

Definition at line 27 of file class.ilMailAddressTypeFactory.php.


The documentation for this class was generated from the following file: