當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Type::loadRelated方法代碼示例

本文整理匯總了PHP中Type::loadRelated方法的典型用法代碼示例。如果您正苦於以下問題:PHP Type::loadRelated方法的具體用法?PHP Type::loadRelated怎麽用?PHP Type::loadRelated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Type的用法示例。


在下文中一共展示了Type::loadRelated方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: loadRelated

 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['thumb'])) {
         $this->thumb = PhotoSize::create($attributes['thumb']);
     }
 }
開發者ID:zelenin,項目名稱:telegram-bot-api,代碼行數:10,代碼來源:Document.php

示例2: loadRelated

 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['user'])) {
         $this->user = User::create($attributes['user']);
     }
 }
開發者ID:zelenin,項目名稱:telegram-bot-api,代碼行數:10,代碼來源:ChatMember.php

示例3: loadRelated

 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['location'])) {
         $this->location = Location::create($attributes['location']);
     }
 }
開發者ID:zelenin,項目名稱:telegram-bot-api,代碼行數:10,代碼來源:Venue.php

示例4: loadRelated

 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     $this->photos = [];
     if ($attributes['total_count'] > 0) {
         $this->photos = array_map(function ($photo) {
             return new PhotoSize($photo);
         }, $attributes['photos'][0]);
     }
 }
開發者ID:zelenin,項目名稱:telegram-bot-api,代碼行數:13,代碼來源:UserProfilePhotos.php

示例5: loadRelated

 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['from'])) {
         $this->from = User::create($attributes['from']);
     }
     if (isset($attributes['message'])) {
         $this->message = Message::create($attributes['message']);
     }
 }
開發者ID:zelenin,項目名稱:telegram-bot-api,代碼行數:13,代碼來源:CallbackQuery.php

示例6: loadRelated

 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['from'])) {
         $this->from = User::create($attributes['from']);
     }
     if (isset($attributes['chat'])) {
         $this->chat = isset($attributes['chat']->title) ? GroupChat::create($attributes['chat']) : User::create($attributes['chat']);
     }
     if (isset($attributes['forward_from'])) {
         $this->forward_from = User::create($attributes['forward_from']);
     }
     if (isset($attributes['forward_from_chat'])) {
         $this->forward_from_chat = Chat::create($attributes['forward_from_chat']);
     }
     if (isset($attributes['reply_to_message'])) {
         $this->reply_to_message = Message::create($attributes['reply_to_message']);
     }
     if (isset($attributes['entities'])) {
         $this->entities = array_map(function ($entity) {
             return MessageEntity::create($entity);
         }, $attributes['entities']);
     }
     if (isset($attributes['audio'])) {
         $this->audio = Audio::create($attributes['audio']);
     }
     if (isset($attributes['document'])) {
         $this->document = Document::create($attributes['document']);
     }
     if (isset($attributes['photo'])) {
         $this->photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['photo']);
     }
     if (isset($attributes['sticker'])) {
         $this->sticker = Sticker::create($attributes['sticker']);
     }
     if (isset($attributes['video'])) {
         $this->video = Video::create($attributes['video']);
     }
     if (isset($attributes['voice'])) {
         $this->voice = Voice::create($attributes['voice']);
     }
     if (isset($attributes['contact'])) {
         $this->contact = Contact::create($attributes['contact']);
     }
     if (isset($attributes['location'])) {
         $this->location = Location::create($attributes['location']);
     }
     if (isset($attributes['venue'])) {
         $this->venue = Venue::create($attributes['venue']);
     }
     if (isset($attributes['new_chat_member'])) {
         $this->new_chat_member = User::create($attributes['new_chat_member']);
     }
     if (isset($attributes['left_chat_member'])) {
         $this->left_chat_member = new User($attributes['left_chat_member']);
     }
     if (isset($attributes['new_chat_photo'])) {
         $this->new_chat_photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['new_chat_photo']);
     }
 }
開發者ID:zelenin,項目名稱:telegram-bot-api,代碼行數:67,代碼來源:Message.php


注:本文中的Type::loadRelated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。