order_id; } public function type(): string { return $this->type; } public function occurred_at(): \DateTimeImmutable { return $this->occurred_at; } public function source(): string { return $this->source; } public function value(): ?string { return $this->value; } /** * Stable operation key for R1 formation. Different Woo callbacks for the same * order intentionally converge on this key. */ public function r1_operation_key(): string { return 'snapshot:' . $this->order_id . ':R1'; } /** @return array */ public function to_array(): array { return array( 'order_id' => $this->order_id, 'type' => $this->type, 'value' => $this->value, 'source' => $this->source, 'occurred_at' => $this->occurred_at->setTimezone( new \DateTimeZone( 'UTC' ) )->format( 'Y-m-d\TH:i:s\Z' ), ); } private static function now(): \DateTimeImmutable { return new \DateTimeImmutable( 'now', new \DateTimeZone( 'UTC' ) ); } }