| @@ 88-103 (lines=16) @@ | ||
| 85 | /** |
|
| 86 | * @return IApp[] |
|
| 87 | */ |
|
| 88 | protected function getApps() { |
|
| 89 | if (!empty($this->apps)) { |
|
| 90 | return $this->apps; |
|
| 91 | } |
|
| 92 | ||
| 93 | $this->apps = []; |
|
| 94 | foreach ($this->appsClosures as $closure) { |
|
| 95 | $app = $closure(); |
|
| 96 | if (!($app instanceof IApp)) { |
|
| 97 | throw new \InvalidArgumentException('The given notification app does not implement the IApp interface'); |
|
| 98 | } |
|
| 99 | $this->apps[] = $app; |
|
| 100 | } |
|
| 101 | ||
| 102 | return $this->apps; |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * @return INotifier[] |
|
| @@ 108-123 (lines=16) @@ | ||
| 105 | /** |
|
| 106 | * @return INotifier[] |
|
| 107 | */ |
|
| 108 | protected function getNotifiers() { |
|
| 109 | if (!empty($this->notifiers)) { |
|
| 110 | return $this->notifiers; |
|
| 111 | } |
|
| 112 | ||
| 113 | $this->notifiers = []; |
|
| 114 | foreach ($this->notifiersClosures as $closure) { |
|
| 115 | $notifier = $closure(); |
|
| 116 | if (!($notifier instanceof INotifier)) { |
|
| 117 | throw new \InvalidArgumentException('The given notifier does not implement the INotifier interface'); |
|
| 118 | } |
|
| 119 | $this->notifiers[] = $notifier; |
|
| 120 | } |
|
| 121 | ||
| 122 | return $this->notifiers; |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * @return array[] |
|
| @@ 97-113 (lines=17) @@ | ||
| 94 | /** |
|
| 95 | * @return \OCP\Activity\IConsumer[] |
|
| 96 | */ |
|
| 97 | protected function getConsumers() { |
|
| 98 | if (!empty($this->consumers)) { |
|
| 99 | return $this->consumers; |
|
| 100 | } |
|
| 101 | ||
| 102 | $this->consumers = []; |
|
| 103 | foreach($this->consumersClosures as $consumer) { |
|
| 104 | $c = $consumer(); |
|
| 105 | if ($c instanceof IConsumer) { |
|
| 106 | $this->consumers[] = $c; |
|
| 107 | } else { |
|
| 108 | throw new \InvalidArgumentException('The given consumer does not implement the \OCP\Activity\IConsumer interface'); |
|
| 109 | } |
|
| 110 | } |
|
| 111 | ||
| 112 | return $this->consumers; |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * @return \OCP\Activity\IExtension[] |
|
| @@ 118-134 (lines=17) @@ | ||
| 115 | /** |
|
| 116 | * @return \OCP\Activity\IExtension[] |
|
| 117 | */ |
|
| 118 | protected function getExtensions() { |
|
| 119 | if (!empty($this->extensions)) { |
|
| 120 | return $this->extensions; |
|
| 121 | } |
|
| 122 | ||
| 123 | $this->extensions = []; |
|
| 124 | foreach($this->extensionsClosures as $extension) { |
|
| 125 | $e = $extension(); |
|
| 126 | if ($e instanceof IExtension) { |
|
| 127 | $this->extensions[] = $e; |
|
| 128 | } else { |
|
| 129 | throw new \InvalidArgumentException('The given extension does not implement the \OCP\Activity\IExtension interface'); |
|
| 130 | } |
|
| 131 | } |
|
| 132 | ||
| 133 | return $this->extensions; |
|
| 134 | } |
|
| 135 | ||
| 136 | /** |
|
| 137 | * Generates a new IEvent object |
|