本文整理汇总了PHP中CL\Slack\Payload\PayloadInterface类的典型用法代码示例。如果您正苦于以下问题:PHP PayloadInterface类的具体用法?PHP PayloadInterface怎么用?PHP PayloadInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PayloadInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: serialize
/**
* @param PayloadInterface $payload
*
* @return array The serialized payload data
*/
public function serialize(PayloadInterface $payload)
{
if ($payload instanceof AdvancedSerializeInterface) {
$payload->beforeSerialize($this->serializer);
}
$serializedPayload = $this->serializer->serialize($payload, 'json');
if (!$serializedPayload || !is_string($serializedPayload)) {
throw new \RuntimeException(sprintf('Failed to serialize payload; expected it to be a string, got: %s', var_export($serializedPayload, true)));
}
return json_decode($serializedPayload, true);
}
示例2: getExpectedPayloadData
/**
* @inheritdoc
*
* @param ImHistoryPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['channel' => $payload->getImId(), 'latest' => $payload->getLatest(), 'oldest' => $payload->getOldest(), 'count' => $payload->getCount()];
}
示例3: getExpectedPayloadData
/**
* @inheritdoc
*
* @param ChannelsKickPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['channel' => $payload->getChannelId(), 'user' => $payload->getUserId()];
}
示例4: getExpectedPayloadData
/**
* @inheritdoc
*
* @param OauthAccessPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['client_id' => $payload->getClientId(), 'client_secret' => $payload->getClientSecret(), 'code' => $payload->getCode(), 'redirect_uri' => $payload->getRedirectUri()];
}
示例5: getExpectedPayloadData
/**
* @inheritdoc
*
* @param ApiTestPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['error' => $payload->getError(), 'foo' => $payload->getArgument('foo')];
}
示例6: getExpectedPayloadData
/**
* {@inheritdoc}
*
* @param ChatPostMessagePayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
/** @var Attachment $attachment */
$attachment = $payload->getAttachments()->first();
/** @var AttachmentField $attachmentField */
$attachmentField = $attachment->getFields()->first();
return ['channel' => $payload->getChannel(), 'text' => $payload->getText(), 'username' => $payload->getUsername(), 'icon_emoji' => $payload->getIconEmoji(), 'icon_url' => $payload->getIconUrl(), 'unfurl_media' => $payload->getUnfurlMedia(), 'unfurl_links' => $payload->getUnfurlLinks(), 'link_names' => $payload->getLinkNames(), 'parse' => $payload->getParse(), 'attachments' => json_encode([['title' => $attachment->getTitle(), 'title_link' => $attachment->getTitleLink(), 'image_url' => $attachment->getImageUrl(), 'author_name' => $attachment->getAuthorName(), 'author_link' => $attachment->getAuthorLink(), 'author_icon' => $attachment->getAuthorIcon(), 'pre_text' => $attachment->getPreText(), 'text' => $attachment->getText(), 'color' => $attachment->getColor(), 'fallback' => $attachment->getFallback(), 'fields' => [['title' => $attachmentField->getTitle(), 'value' => $attachmentField->getValue(), 'short' => $attachmentField->isShort()]]]])];
}
示例7: getExpectedPayloadData
/**
* @inheritdoc
*
* @param ImListPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['exclude_archived' => $payload->isExcludeArchived()];
}
示例8: getExpectedPayloadData
/**
* @inheritdoc
*
* @param AbstractSearchPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['query' => $payload->getQuery(), 'page' => $payload->getPage(), 'count' => $payload->getCount(), 'highlight' => $payload->getHighlight(), 'sort' => $payload->getSort(), 'sort_dir' => $payload->getSortDir()];
}
示例9: getExpectedPayloadData
/**
* {@inheritdoc}
*
* @param FilesListPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['page' => $payload->getPage(), 'count' => $payload->getCount(), 'types' => $payload->getTypes(), 'user' => $payload->getUserId(), 'ts_from' => $payload->getTimestampFrom()->format('U'), 'ts_to' => $payload->getTimestampTo()->format('U')];
}
示例10: getExpectedPayloadData
/**
* @inheritdoc
*
* @param UsersSetPresencePayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['presence' => $payload->getPresence()];
}
示例11: getExpectedPayloadData
/**
* @inheritdoc
*
* @param FilesUploadPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['title' => $payload->getTitle(), 'content' => $payload->getContent(), 'filename' => $payload->getFilename(), 'file_type' => $payload->getFileType(), 'channels' => $payload->getChannelsAsString()];
}
示例12: getExpectedPayloadData
/**
* {@inheritdoc}
*
* @param StarsListPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['count' => $payload->getCount(), 'page' => $payload->getPage(), 'user' => $payload->getUserId()];
}
示例13: getExpectedPayloadData
/**
* @inheritdoc
*
* @param ChannelsSetTopicPayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['channel' => $payload->getChannelId(), 'topic' => $payload->getTopic()];
}
示例14: getExpectedPayloadData
/**
* {@inheritdoc}
*
* @param ChannelsSetPurposePayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['channel' => $payload->getChannelId(), 'purpose' => $payload->getPurpose()];
}
示例15: getExpectedPayloadData
/**
* {@inheritdoc}
*
* @param GroupsClosePayload $payload
*/
protected function getExpectedPayloadData(PayloadInterface $payload)
{
return ['channel' => $payload->getGroupId()];
}