ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\ResourceStorage\Events\Subject Class Reference
+ Collaboration diagram for ILIAS\ResourceStorage\Events\Subject:

Public Member Functions

 __construct ()
 
 attach (Observer $observer, Event $event)
 
 detach (Observer $observer, Event $event=Event::ALL)
 

Protected Member Functions

 initObserverGroup (string $group)
 

Protected Attributes

array $observer_groups = []
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 27 of file Subject.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\ResourceStorage\Events\Subject::__construct ( )

Definition at line 34 of file Subject.php.

References ALL, and ILIAS\ResourceStorage\Events\Subject\initObserverGroup().

35  {
36  $this->initObserverGroup((Event::ALL)->value);
37  }
event string being used if
+ Here is the call graph for this function:

Member Function Documentation

◆ attach()

ILIAS\ResourceStorage\Events\Subject::attach ( Observer  $observer,
Event  $event 
)

Definition at line 39 of file Subject.php.

References ILIAS\ResourceStorage\Events\Subject\initObserverGroup().

39  : void
40  {
41  $this->initObserverGroup($event->value);
42 
43  $this->observer_groups[$event->value][] = $observer;
44  }
+ Here is the call graph for this function:

◆ detach()

ILIAS\ResourceStorage\Events\Subject::detach ( Observer  $observer,
Event  $event = Event::ALL 
)

Definition at line 46 of file Subject.php.

References $data, Vendor\Package\$e, ALL, ILIAS\ResourceStorage\Events\Observer\getId(), and ILIAS\ResourceStorage\Events\Subject\initObserverGroup().

46  : void
47  {
48  $this->initObserverGroup($event->value);
49 
50  foreach ($this->observer_groups[$event->value] as $index => $attached_observer) {
51  if ($attached_observer->getId() === $observer->getId()) {
52  unset($this->observer_groups[$event->value][$index]);
53  }
54  }
55  }
+ Here is the call graph for this function:

◆ initObserverGroup()

ILIAS\ResourceStorage\Events\Subject::initObserverGroup ( string  $group)
protected

Definition at line 82 of file Subject.php.

Referenced by ILIAS\ResourceStorage\Events\Subject\__construct(), ILIAS\ResourceStorage\Events\Subject\attach(), and ILIAS\ResourceStorage\Events\Subject\detach().

82  : void
83  {
84  if (!isset($this->observer_groups[$group])) {
85  $this->observer_groups[$group] = [];
86  }
87  }
+ Here is the caller graph for this function:

Field Documentation

◆ $observer_groups

array ILIAS\ResourceStorage\Events\Subject::$observer_groups = []
protected

Definition at line 32 of file Subject.php.


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