/** * @return array */ function jsonSerialize() { $result = parent::jsonSerialize(); $result['photo_url'] = $this->photoUrl; $result['thumb_url'] = $this->thumbUrl; if ($this->photoHeight !== null) { $result['photo_height'] = $this->photoHeight; } if ($this->photoWidth !== null) { $result['photo_width'] = $this->photoWidth; } if ($this->title !== null) { $result['title'] = $this->title; } if ($this->description !== null) { $result['description'] = $this->description; } if ($this->caption !== null) { $result['caption'] = $this->caption; } return $result; }
public function testJsonSerialize() { $this->inlineQueryResult->setReplyMarkup(new InlineKeyboardMarkup(['1', '2', '3'])); $arrayResult = $this->inlineQueryResult->jsonSerialize(); $result = json_decode(json_encode($arrayResult), true); $this->assertEquals('photo', $result['type']); $this->assertStringStartsWith('steelbot', $result['id']); $this->assertArrayHasKey('input_message_content', $result); $this->assertArrayHasKey('reply_markup', $result); }
/** * @return array */ public function jsonSerialize() { $result = parent::jsonSerialize(); $result = array_merge($result, ['title' => $this->title, 'document_url' => $this->documentUrl, 'mime_type' => $this->mimeType]); $attributes = $this->buildJsonAttributes(['caption' => $this->caption, 'description' => $this->description, 'reply_markup' => $this->replyMarkup, 'input_message_content' => $this->inputMessageContent, 'thumb_url' => $this->thumbUrl, 'thumb_width' => $this->thumbWidth, 'thumb_height' => $this->thumbHeight]); $result = array_merge($result, $attributes); return $result; }
/** * @return array */ public function jsonSerialize() { $result = parent::jsonSerialize(); $result = array_merge($result, ['latitude' => $this->latitude, 'longitude' => $this->longitude, 'title' => $this->title]); $attributes = $this->buildJsonAttributes(['reply_markup' => $this->replyMarkup, 'input_message_content' => $this->inputMessageContent, 'thumb_url' => $this->thumbUrl, 'thumb_width' => $this->thumbWidth, 'thumb_height' => $this->thumbHeight]); $result = array_merge($result, $attributes); return $result; }
/** * InlineQueryResultMpeg4Gif constructor. * * @param string $id * @param string $mpeg4Url * @param string $thumbUrl * @param int|null $mpeg4Width * @param int|null $mpeg4Height * @param string|null $caption * @param string|null $title * @param string|null $messageText * @param string|null $parseMode * @param bool|null $disableWebPagePreview */ public function __construct($id, $mpeg4Url, $thumbUrl, $mpeg4Width = null, $mpeg4Height = null, $caption = null, $title = null, $messageText = null, $parseMode = null, $disableWebPagePreview = null) { parent::__construct($id, $title, $messageText, $parseMode, $disableWebPagePreview); $this->mpeg4Url = $mpeg4Url; $this->thumbUrl = $thumbUrl; $this->mpeg4Width = $mpeg4Width; $this->mpeg4Height = $mpeg4Height; $this->caption = $caption; }
/** * InlineQueryResultArticle constructor. * * @param string $id * @param string $title * @param string $messageText * @param string|null $parseMode * @param bool|null $disableWebPagePreview * @param string|null $url * @param bool|null $hideUrl * @param string|null $description * @param string|null $thumbUrl * @param int|null $thumbWidth * @param int|null $thumbHeight */ public function __construct($id, $title, $messageText, $parseMode = null, $disableWebPagePreview = null, $url = null, $hideUrl = null, $description = null, $thumbUrl = null, $thumbWidth = null, $thumbHeight = null) { parent::__construct($id, $title, $messageText, $parseMode, $disableWebPagePreview); $this->url = $url; $this->hideUrl = $hideUrl; $this->description = $description; $this->thumbUrl = $thumbUrl; $this->thumbWidth = $thumbWidth; $this->thumbHeight = $thumbHeight; }
public function jsonSerialize() { $result = parent::jsonSerialize(); $result['voice_file_id'] = $this->voiceFileId; if ($this->title !== null) { $result['title'] = $this->title; } if ($this->caption !== null) { $result['caption'] = $this->caption; } if ($this->replyMarkup) { $result['reply_markup'] = $this->replyMarkup; } if ($this->inputMessageContent) { $result['input_message_content'] = $this->inputMessageContent; } return $result; }
/** * InlineQueryResultVideo constructor. * * @param string $id * @param string $videoUrl * @param string $thumbUrl * @param string $mimeType * @param string|null $messageText * @param string|null $parseMode * @param bool|null $disableWebPagePreview * @param int|null $videoWidth * @param int|null $videoHeight * @param int|null $videoDuration * @param string|null $title * @param string|null $description */ public function __construct($id, $videoUrl, $thumbUrl, $mimeType, $messageText = null, $parseMode = null, $disableWebPagePreview = null, $videoWidth = null, $videoHeight = null, $videoDuration = null, $title = null, $description = null) { parent::__construct($id, $title, $messageText, $parseMode, $disableWebPagePreview); $this->videoUrl = $videoUrl; $this->thumbUrl = $thumbUrl; $this->mimeType = $mimeType; $this->videoWidth = $videoWidth; $this->videoHeight = $videoHeight; $this->videoDuration = $videoDuration; $this->description = $description; }