user; } /** * @inheritDoc */ public function toArray(): array { return [ 'source' => $this->source->value, 'user' => $this->user->toArray() ]; } /** * @inheritDoc */ public static function fromArray(?array $data): ?ChatBoostSourceGiftCode { if($data === null) { return null; } $object = new self(); $object->source = ChatBoostSourceType::PREMIUM; $object->user = User::fromArray($data['user']); return $object; } }