| @@ 814-829 (lines=16) @@ | ||
| 811 | * |
|
| 812 | * @return \OCP\Comments\ICommentsEventHandler[] |
|
| 813 | */ |
|
| 814 | private function getEventHandlers() { |
|
| 815 | if(!empty($this->eventHandlers)) { |
|
| 816 | return $this->eventHandlers; |
|
| 817 | } |
|
| 818 | ||
| 819 | $this->eventHandlers = []; |
|
| 820 | foreach ($this->eventHandlerClosures as $name => $closure) { |
|
| 821 | $entity = $closure(); |
|
| 822 | if (!($entity instanceof ICommentsEventHandler)) { |
|
| 823 | throw new \InvalidArgumentException('The given entity does not implement the ICommentsEntity interface'); |
|
| 824 | } |
|
| 825 | $this->eventHandlers[$name] = $entity; |
|
| 826 | } |
|
| 827 | ||
| 828 | return $this->eventHandlers; |
|
| 829 | } |
|
| 830 | ||
| 831 | /** |
|
| 832 | * sends notifications to the registered entities |
|
| @@ 97-112 (lines=16) @@ | ||
| 94 | /** |
|
| 95 | * @return IApp[] |
|
| 96 | */ |
|
| 97 | protected function getApps() { |
|
| 98 | if (!empty($this->apps)) { |
|
| 99 | return $this->apps; |
|
| 100 | } |
|
| 101 | ||
| 102 | $this->apps = []; |
|
| 103 | foreach ($this->appsClosures as $closure) { |
|
| 104 | $app = $closure(); |
|
| 105 | if (!($app instanceof IApp)) { |
|
| 106 | throw new \InvalidArgumentException('The given notification app does not implement the IApp interface'); |
|
| 107 | } |
|
| 108 | $this->apps[] = $app; |
|
| 109 | } |
|
| 110 | ||
| 111 | return $this->apps; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * @return INotifier[] |
|
| @@ 117-132 (lines=16) @@ | ||
| 114 | /** |
|
| 115 | * @return INotifier[] |
|
| 116 | */ |
|
| 117 | protected function getNotifiers() { |
|
| 118 | if (!empty($this->notifiers)) { |
|
| 119 | return $this->notifiers; |
|
| 120 | } |
|
| 121 | ||
| 122 | $this->notifiers = []; |
|
| 123 | foreach ($this->notifiersClosures as $closure) { |
|
| 124 | $notifier = $closure(); |
|
| 125 | if (!($notifier instanceof INotifier)) { |
|
| 126 | throw new \InvalidArgumentException('The given notifier does not implement the INotifier interface'); |
|
| 127 | } |
|
| 128 | $this->notifiers[] = $notifier; |
|
| 129 | } |
|
| 130 | ||
| 131 | return $this->notifiers; |
|
| 132 | } |
|
| 133 | ||
| 134 | /** |
|
| 135 | * @return array[] |
|
| @@ 108-124 (lines=17) @@ | ||
| 105 | /** |
|
| 106 | * @return \OCP\Activity\IConsumer[] |
|
| 107 | */ |
|
| 108 | protected function getConsumers() { |
|
| 109 | if (!empty($this->consumers)) { |
|
| 110 | return $this->consumers; |
|
| 111 | } |
|
| 112 | ||
| 113 | $this->consumers = []; |
|
| 114 | foreach($this->consumersClosures as $consumer) { |
|
| 115 | $c = $consumer(); |
|
| 116 | if ($c instanceof IConsumer) { |
|
| 117 | $this->consumers[] = $c; |
|
| 118 | } else { |
|
| 119 | throw new \InvalidArgumentException('The given consumer does not implement the \OCP\Activity\IConsumer interface'); |
|
| 120 | } |
|
| 121 | } |
|
| 122 | ||
| 123 | return $this->consumers; |
|
| 124 | } |
|
| 125 | ||
| 126 | /** |
|
| 127 | * @return \OCP\Activity\IExtension[] |
|
| @@ 129-145 (lines=17) @@ | ||
| 126 | /** |
|
| 127 | * @return \OCP\Activity\IExtension[] |
|
| 128 | */ |
|
| 129 | protected function getExtensions() { |
|
| 130 | if (!empty($this->extensions)) { |
|
| 131 | return $this->extensions; |
|
| 132 | } |
|
| 133 | ||
| 134 | $this->extensions = []; |
|
| 135 | foreach($this->extensionsClosures as $extension) { |
|
| 136 | $e = $extension(); |
|
| 137 | if ($e instanceof IExtension) { |
|
| 138 | $this->extensions[] = $e; |
|
| 139 | } else { |
|
| 140 | throw new \InvalidArgumentException('The given extension does not implement the \OCP\Activity\IExtension interface'); |
|
| 141 | } |
|
| 142 | } |
|
| 143 | ||
| 144 | return $this->extensions; |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * Generates a new IEvent object |
|