| @@ 125-140 (lines=16) @@ | ||
| 122 | * |
|
| 123 | * @return self |
|
| 124 | */ |
|
| 125 | public function fetchNotifications(array $notifications = []) |
|
| 126 | { |
|
| 127 | if (empty($notifications)) { |
|
| 128 | $notifications = $this->session->get('notifier.notifications', []); |
|
| 129 | } |
|
| 130 | ||
| 131 | foreach ($notifications as $notification) { |
|
| 132 | if ($notification->getId() > self::$notificationId) { |
|
| 133 | self::$notificationId = $notification->getId(); |
|
| 134 | } |
|
| 135 | } |
|
| 136 | ||
| 137 | $this->setNotifications($notifications); |
|
| 138 | ||
| 139 | return $this; |
|
| 140 | } |
|
| 141 | ||
| 142 | /** |
|
| 143 | * Store notifications in Session. |
|
| @@ 149-164 (lines=16) @@ | ||
| 146 | * |
|
| 147 | * @return self |
|
| 148 | */ |
|
| 149 | public function storeNotifications(array $notifications = []) |
|
| 150 | { |
|
| 151 | if (empty($notifications)) { |
|
| 152 | $notifications = $this->getNotifications(); |
|
| 153 | } |
|
| 154 | ||
| 155 | foreach ($notifications as $notification) { |
|
| 156 | if ($notification->getId() > self::$notificationId) { |
|
| 157 | self::$notificationId = $notification->getId(); |
|
| 158 | } |
|
| 159 | } |
|
| 160 | ||
| 161 | $this->session->put('notifier.notifications', $notifications); |
|
| 162 | ||
| 163 | return $this; |
|
| 164 | } |
|
| 165 | ||
| 166 | /** |
|
| 167 | * Convert an array of Notification objects to an array of arrays. |
|