ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilGroupNameAsMailValidator Class Reference
+ Collaboration diagram for ilGroupNameAsMailValidator:

Public Member Functions

 __construct (protected string $host, ?callable $group_name_check_callable=null)
 
 validate (ilMailAddress $address)
 Validates if the given address contains a valid group name to send an email. More...
 

Protected Attributes

 $group_name_check_callable
 

Private Member Functions

 isHostValid (string $host)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilGroupNameAsMailValidator::__construct ( protected string  $host,
?callable  $group_name_check_callable = null 
)
Parameters
callable(string)bool|null $group_name_check_callable

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

References $group_name_check_callable, and ilUtil\groupNameExists().

30  {
31  $this->group_name_check_callable = $group_name_check_callable ?? static fn(string $group_name): bool => ilUtil::groupNameExists($group_name);
32  }
+ Here is the call graph for this function:

Member Function Documentation

◆ isHostValid()

ilGroupNameAsMailValidator::isHostValid ( string  $host)
private

Definition at line 45 of file class.ilGroupNameAsMailValidator.php.

Referenced by validate().

45  : bool
46  {
47  return ($host === $this->host || $host === '');
48  }
+ Here is the caller graph for this function:

◆ validate()

ilGroupNameAsMailValidator::validate ( ilMailAddress  $address)

Validates if the given address contains a valid group name to send an email.

Definition at line 37 of file class.ilGroupNameAsMailValidator.php.

References $group_name_check_callable, ilMailAddress\getHost(), ilMailAddress\getMailbox(), and isHostValid().

37  : bool
38  {
39  $group_name = substr($address->getMailbox(), 1);
40 
42  return $func($group_name) && $this->isHostValid($address->getHost());
43  }
+ Here is the call graph for this function:

Field Documentation

◆ $group_name_check_callable

ilGroupNameAsMailValidator::$group_name_check_callable
protected

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

Referenced by __construct(), and validate().


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