type; } /** * @inheritDoc */ public function toArray(): array { return [ 'type' => $this->type->toArray() ]; } /** * @inheritDoc */ public static function fromArray(array $data): ObjectTypeInterface { if (!isset($data['type'])) { throw new InvalidArgumentException('ChatBackground expected type'); } $object = new self(); $object->type = BackgroundType::fromArray($data['type']); return $object; } }