getFragmentNext() ?? 0; $end = $start + $limit; $nextStatus = Task::STATUS_READY; if ($end > $this->getFragmentTotal()) { $end = $this->getFragmentTotal(); $nextStatus = Task::STATUS_COMPLETED; } $where = ''; $whereVars = []; if (!empty($this->getData()['users'])) { $whereIn = implode(',', array_map(static fn ($u) => '?', $this->getData()['users'])); $where = "WHERE id IN ($whereIn)"; $whereVars = array_map(static fn ($u) => $u['id'], $this->getData()['users']); } $recipients = DB::getInstance()->query( <<getData()['type'], $this->getData()['title'], $this->getData()['content'], array_map(static fn ($r) => $r->id, $recipients->results()), $this->getUserId(), $this->getData()['callback'], $this->getData()['skip_purify'] ?? false ); $notification->send(); $this->setOutput(['userIds' => $whereVars, 'start' => $start, 'end' => $end, 'next_status' => $nextStatus]); $this->setFragmentNext($end); return $nextStatus; } public static function parseContent(int $userId, string $title, string $content, bool $skipPurify = false): string { $user = new User($userId); $event = new GenerateNotificationContentEvent($content, $title, $user, $skipPurify); EventHandler::executeEvent($event); return $event->content; } }