$row */ public static function fromRow( array $row ): self { $r = new self(); $r->id = (int) ( $row['id'] ?? 0 ); $r->optInId = (int) ( $row['optin_id'] ?? 0 ); $r->integration = (string) ( $row['integration'] ?? '' ); $r->actionId = (string) ( $row['action_id'] ?? '' ); $r->actionKind = (string) ( $row['action_kind'] ?? '' ); $r->actionLabel = (string) ( $row['action_label'] ?? '' ); $r->fingerprint = (string) ( $row['config_fingerprint'] ?? '' ); $r->status = (string) ( $row['status'] ?? FollowUpStatus::PENDING ); $r->attempts = (int) ( $row['attempts'] ?? 0 ); $r->budgetAttempts = (int) ( $row['budget_attempts'] ?? 0 ); $r->attemptId = (string) ( $row['attempt_id'] ?? '' ); $r->trigger = (string) ( $row['attempt_trigger'] ?? '' ); $r->startedAt = (string) ( $row['started_at'] ?? '' ); $r->finishedAt = (string) ( $row['finished_at'] ?? '' ); $r->nextAttemptAt = (string) ( $row['next_attempt_at'] ?? '' ); $r->leaseUntil = (string) ( $row['lease_until'] ?? '' ); $r->errorCode = (string) ( $row['error_code'] ?? '' ); $r->retryable = ! empty( $row['retryable'] ); $r->httpStatus = (int) ( $row['http_status'] ?? 0 ); $r->responseKind = (string) ( $row['response_kind'] ?? '' ); $r->entryRef = (string) ( $row['entry_ref'] ?? '' ); $r->evidence = (string) ( $row['evidence'] ?? '' ); $r->createdAt = (string) ( $row['created_at'] ?? '' ); return $r; } /** * Admin/REST representation. Contains no personal data by * construction — every field is structural. * * @return array */ public function toArray(): array { return array( 'id' => $this->id, 'optin_id' => $this->optInId, 'integration' => $this->integration, 'action_id' => $this->actionId, 'action_kind' => $this->actionKind, 'action_label' => $this->actionLabel, 'status' => $this->status, 'attempts' => $this->attempts, 'budget_attempts' => $this->budgetAttempts, 'attempt_id' => $this->attemptId, 'trigger' => $this->trigger, 'started_at' => $this->startedAt, 'finished_at' => $this->finishedAt, 'next_attempt_at' => $this->nextAttemptAt, 'error_code' => $this->errorCode, 'retryable' => $this->retryable, 'http_status' => $this->httpStatus, 'response_kind' => $this->responseKind, 'entry_ref' => $this->entryRef, 'evidence' => $this->evidence, 'created_at' => $this->createdAt, ); } /** * Rebuild the action descriptor this row was planned from. */ public function toAction(): FollowUpAction { return new FollowUpAction( $this->actionId, $this->actionKind, $this->actionLabel, true, '', $this->entryRef ); } }