ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMailCachedAddressType Class Reference

Class ilMailCachedAddressType. More...

+ Inheritance diagram for ilMailCachedAddressType:
+ Collaboration diagram for ilMailCachedAddressType:

Public Member Functions

 __construct (\ilMailAddressType $inner, bool $useCache)
 ilMailCachedRoleAddressType constructor. More...
 
 validate (int $senderId)
 Validates the parsed recipients and set errors accordingly.
See also
\ilMailAddressType::getErrors
Parameters
$senderIdinteger The id of the acting ILIAS user, can be used for permission checks etc.
Returns
bool
More...
 
 getErrors ()
 Returns a list of errors determined in the validation process.The errors should be reset everytime the validation is triggered.

See also
\ilMailAddressType::validate
Returns
\ilMailError
More...
 
 getAddress ()
 The address instance used for validation and user id lookup.
Returns
\ilMailAddress
More...
 
 resolve ()
 Returns an array of resolved user ids based on an address instance.
Returns
int[]
More...
 
 resolve ()
 Returns an array of resolved user ids based on an address instance. More...
 
 validate (int $senderId)
 Validates the parsed recipients and set errors accordingly. More...
 
 getErrors ()
 Returns a list of errors determined in the validation process. More...
 
 getAddress ()
 The address instance used for validation and user id lookup. More...
 

Protected Attributes

 $inner
 
 $useCache = true
 

Static Protected Attributes

static $usrIdsByAddressCache = []
 
static $isValidCache = []
 

Private Member Functions

 getCacheKey ()
 

Detailed Description

Class ilMailCachedAddressType.

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

Constructor & Destructor Documentation

◆ __construct()

ilMailCachedAddressType::__construct ( \ilMailAddressType  $inner,
bool  $useCache 
)

ilMailCachedRoleAddressType constructor.

Parameters
\ilMailAddressType$inner
bool$useCache

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

References $inner, and $useCache.

Member Function Documentation

◆ getAddress()

ilMailCachedAddressType::getAddress ( )

The address instance used for validation and user id lookup.

Returns
\ilMailAddress

Implements ilMailAddressType.

Definition at line 66 of file class.ilMailCachedAddressType.php.

67 {
68 return $this->inner->getAddress();
69 }
Class ilMailAddress.

Referenced by getCacheKey().

+ Here is the caller graph for this function:

◆ getCacheKey()

ilMailCachedAddressType::getCacheKey ( )
private
Returns
string

Definition at line 35 of file class.ilMailCachedAddressType.php.

35 : string
36 {
37 $address = $this->getAddress();
38 return (string) $address;
39 }
getAddress()
The address instance used for validation and user id lookup.\ilMailAddress

References getAddress().

Referenced by resolve(), and validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getErrors()

ilMailCachedAddressType::getErrors ( )

Returns a list of errors determined in the validation process.The errors should be reset everytime the validation is triggered.

See also
\ilMailAddressType::validate
Returns
\ilMailError

Implements ilMailAddressType.

Definition at line 58 of file class.ilMailCachedAddressType.php.

58 : array
59 {
60 return $this->inner->getErrors();
61 }

◆ resolve()

ilMailCachedAddressType::resolve ( )

Returns an array of resolved user ids based on an address instance.

Returns
int[]

Implements ilMailAddressType.

Definition at line 74 of file class.ilMailCachedAddressType.php.

74 : array
75 {
76 $cacheKey = $this->getCacheKey();
77
78 if (!$this->useCache || !isset(self::$usrIdsByAddressCache[$cacheKey])) {
79 self::$usrIdsByAddressCache[$cacheKey] = $this->inner->resolve();
80 }
81
82 return self::$usrIdsByAddressCache[$cacheKey];
83 }

References getCacheKey().

+ Here is the call graph for this function:

◆ validate()

ilMailCachedAddressType::validate ( int  $senderId)

Validates the parsed recipients and set errors accordingly.

See also
\ilMailAddressType::getErrors
Parameters
$senderIdinteger The id of the acting ILIAS user, can be used for permission checks etc.
Returns
bool

Implements ilMailAddressType.

Definition at line 44 of file class.ilMailCachedAddressType.php.

44 : bool
45 {
46 $cacheKey = $this->getCacheKey();
47
48 if (!$this->useCache || !isset(self::$isValidCache[$cacheKey])) {
49 self::$isValidCache[$cacheKey] = $this->inner->validate($senderId);
50 }
51
52 return self::$isValidCache[$cacheKey];
53 }

References getCacheKey().

+ Here is the call graph for this function:

Field Documentation

◆ $inner

ilMailCachedAddressType::$inner
protected

Definition at line 16 of file class.ilMailCachedAddressType.php.

Referenced by __construct().

◆ $isValidCache

ilMailCachedAddressType::$isValidCache = []
staticprotected

Definition at line 13 of file class.ilMailCachedAddressType.php.

◆ $useCache

ilMailCachedAddressType::$useCache = true
protected

Definition at line 19 of file class.ilMailCachedAddressType.php.

Referenced by __construct().

◆ $usrIdsByAddressCache

ilMailCachedAddressType::$usrIdsByAddressCache = []
staticprotected

Definition at line 10 of file class.ilMailCachedAddressType.php.


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