当前位置: 首页>>代码示例>>PHP>>正文


PHP Payload\PayloadInterface类代码示例

本文整理汇总了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);
 }
开发者ID:benoitgeerinck,项目名称:slack,代码行数:16,代码来源:PayloadSerializer.php

示例2: getExpectedPayloadData

 /**
  * @inheritdoc
  *
  * @param ImHistoryPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getImId(), 'latest' => $payload->getLatest(), 'oldest' => $payload->getOldest(), 'count' => $payload->getCount()];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:ImHistoryPayloadTest.php

示例3: getExpectedPayloadData

 /**
  * @inheritdoc
  *
  * @param ChannelsKickPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getChannelId(), 'user' => $payload->getUserId()];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:ChannelsKickPayloadTest.php

示例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()];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:OauthAccessPayloadTest.php

示例5: getExpectedPayloadData

 /**
  * @inheritdoc
  *
  * @param ApiTestPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['error' => $payload->getError(), 'foo' => $payload->getArgument('foo')];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:ApiTestPayloadTest.php

示例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()]]]])];
 }
开发者ID:benoitgeerinck,项目名称:slack,代码行数:13,代码来源:ChatPostMessagePayloadTest.php

示例7: getExpectedPayloadData

 /**
  * @inheritdoc
  *
  * @param ImListPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['exclude_archived' => $payload->isExcludeArchived()];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:ImListPayloadTest.php

示例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()];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:AbstractSearchPayloadTest.php

示例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')];
 }
开发者ID:benoitgeerinck,项目名称:slack,代码行数:9,代码来源:FilesListPayloadTest.php

示例10: getExpectedPayloadData

 /**
  * @inheritdoc
  *
  * @param UsersSetPresencePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['presence' => $payload->getPresence()];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:UsersSetPresencePayloadTest.php

示例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()];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:FilesUploadPayloadTest.php

示例12: getExpectedPayloadData

 /**
  * {@inheritdoc}
  *
  * @param StarsListPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['count' => $payload->getCount(), 'page' => $payload->getPage(), 'user' => $payload->getUserId()];
 }
开发者ID:wogsland,项目名称:slack,代码行数:9,代码来源:StarsListPayloadTest.php

示例13: getExpectedPayloadData

 /**
  * @inheritdoc
  *
  * @param ChannelsSetTopicPayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getChannelId(), 'topic' => $payload->getTopic()];
 }
开发者ID:salt-lick,项目名称:slack,代码行数:9,代码来源:ChannelsSetTopicPayloadTest.php

示例14: getExpectedPayloadData

 /**
  * {@inheritdoc}
  *
  * @param ChannelsSetPurposePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getChannelId(), 'purpose' => $payload->getPurpose()];
 }
开发者ID:benoitgeerinck,项目名称:slack,代码行数:9,代码来源:ChannelsSetPurposePayloadTest.php

示例15: getExpectedPayloadData

 /**
  * {@inheritdoc}
  *
  * @param GroupsClosePayload $payload
  */
 protected function getExpectedPayloadData(PayloadInterface $payload)
 {
     return ['channel' => $payload->getGroupId()];
 }
开发者ID:wogsland,项目名称:slack,代码行数:9,代码来源:GroupsClosePayloadTest.php


注:本文中的CL\Slack\Payload\PayloadInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。