asOf = unix_epoch(); $this->lastPrayed = null; } else { $this->id = $req->id; $this->userId = $req->userId; $this->snoozedUntil = $req->snoozedUntil; $this->showAfter = $req->showAfter; $this->recurrenceType = $req->recurrenceType; $this->recurrence = $req->recurrence; usort($req->history, AsOf::newestToOldest(...)); $this->asOf = $req->history[array_key_first($req->history)]->asOf; $lastText = array_filter($req->history, fn (History $it) => !is_null($it->text)); $this->text = $lastText[array_key_first($lastText)]->text; $lastPrayed = array_filter($req->history, fn (History $it) => $it->isPrayed()); if ($lastPrayed) $this->lastPrayed = $lastPrayed[array_key_first($lastPrayed)]->asOf; if ($full) { usort($req->notes, AsOf::newestToOldest(...)); $this->history = $req->history; $this->notes = $req->notes; } } } }