ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilGroupNameAsMailValidator Class Reference
+ Collaboration diagram for ilGroupNameAsMailValidator:

Public Member Functions

 __construct ($host)
 
 validate (\ilMailAddress $address)
 Validates if the given address contains a valid group name to send an email. More...
 

Private Member Functions

 isHostValid ($host)
 Checks if the given host is valid in the email context. More...
 

Private Attributes

 $host
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilGroupNameAsMailValidator::__construct (   $host)
Parameters
string$host

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

References $host.

13  {
14  $this->host = $host;
15  }

Member Function Documentation

◆ isHostValid()

ilGroupNameAsMailValidator::isHostValid (   $host)
private

Checks if the given host is valid in the email context.

Parameters
string$host
Returns
bool

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

References $host.

Referenced by validate().

39  {
40  return ($host == $this->host || 0 === strlen($host));
41  }
+ 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.

Parameters
ilMailAddress$address
Returns
bool

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

References ilMailAddress\getHost(), ilMailAddress\getMailbox(), ilUtil\groupNameExists(), and isHostValid().

23  {
24  $groupName = substr($address->getMailbox(), 1);
25 
26  if (ilUtil::groupNameExists($groupName) && $this->isHostValid($address->getHost())) {
27  return true;
28  }
29 
30  return false;
31  }
static groupNameExists($a_group_name, $a_id=0)
checks if group name already exists.
isHostValid($host)
Checks if the given host is valid in the email context.
+ Here is the call graph for this function:

Field Documentation

◆ $host

ilGroupNameAsMailValidator::$host
private

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

Referenced by __construct(), and isHostValid().


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