id = $id; $this->petId = $petId; $this->quantity = $quantity; $this->shipDate = $shipDate; $this->status = $status; $this->complete = $complete; } public static function fromArray(array $data): self { return new self( $data['id'] ?? null, $data['petId'] ?? null, $data['quantity'] ?? null, isset($data['shipDate']) ? new \DateTime($data['shipDate']) : null, isset($data['status']) ? OrderStatus::tryFrom($data['status']) : null, $data['complete'] ?? null, ); } public function jsonSerialize(): mixed { return [ 'id' => $this->id, 'petId' => $this->petId, 'quantity' => $this->quantity, 'shipDate' => $this->shipDate?->format('c'), 'status' => $this->status, 'complete' => $this->complete, ]; } }