ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilChatroomAppEventListener Class Reference
+ Inheritance diagram for ilChatroomAppEventListener:
+ Collaboration diagram for ilChatroomAppEventListener:

Static Public Member Functions

static handleEvent (string $component, string $event, array $parameter)
 

Private Member Functions

 __construct (ilDBInterface $database)
 
 handle (string $component, string $event, array $parameter)
 
 dbCachePrepare (ilDBInterface $db)
 
 cache (Closure $proc)
 A B More...
 

Private Attributes

readonly CleanUpBans $clean_up
 

Static Private Attributes

static ilChatroomAppEventListener $instance = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilChatroomAppEventListener::__construct ( ilDBInterface  $database)
private

Definition at line 39 of file class.ilChatroomAppEventListener.php.

References dbCachePrepare().

40  {
41  $this->clean_up = new CleanUpBans($this->dbCachePrepare($database));
42  }
+ Here is the call graph for this function:

Member Function Documentation

◆ cache()

ilChatroomAppEventListener::cache ( Closure  $proc)
private

A B

Parameters
Closure(...A)B
Returns
Closure(...A): B

Definition at line 69 of file class.ilChatroomAppEventListener.php.

Referenced by dbCachePrepare().

69  : Closure
70  {
71  $cache = [];
72  return function (...$args) use (&$cache, $proc) {
73  $key = json_encode($args);
74  if (!isset($cache[$key])) {
75  $cache[$key] = $proc(...$args);
76  }
77  return $cache[$key];
78  };
79  }
+ Here is the caller graph for this function:

◆ dbCachePrepare()

ilChatroomAppEventListener::dbCachePrepare ( ilDBInterface  $db)
private
Returns
Closure(string, array): Closure(array): void

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

References cache(), ilDBInterface\execute(), and ilDBInterface\prepare().

Referenced by __construct().

54  : Closure
55  {
56  return $this->cache(function (...$args) use ($db): Closure {
57  $statement = $db->prepare(...$args);
58  return fn(array $values = []) => $db->execute($statement, $values);
59  });
60  }
execute(ilDBStatement $stmt, array $data=[])
prepare(string $a_query, ?array $a_types=null, ?array $a_result_types=null)
Prepare a query (SELECT) statement to be used with execute.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handle()

ilChatroomAppEventListener::handle ( string  $component,
string  $event,
array  $parameter 
)
private

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

44  : void
45  {
46  if ($event === 'deleteUser') {
47  $this->clean_up->removeEntriesOfDeletedUser($parameter['usr_id']);
48  }
49  }

◆ handleEvent()

static ilChatroomAppEventListener::handleEvent ( string  $component,
string  $event,
array  $parameter 
)
static
Parameters
array<string,mixed>$a_parameter

Implements ilAppEventListener.

Definition at line 32 of file class.ilChatroomAppEventListener.php.

References $DIC.

32  : void
33  {
34  global $DIC;
35  self::$instance ??= new self($DIC->database());
36  self::$instance->handle($component, $event, $parameter);
37  }
global $DIC
Definition: shib_login.php:22

Field Documentation

◆ $clean_up

readonly CleanUpBans ilChatroomAppEventListener::$clean_up
private

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

◆ $instance

ilChatroomAppEventListener ilChatroomAppEventListener::$instance = null
staticprivate

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


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