public function mapSubObjects(string $key, array $data) : TelegramTypes { switch ($key) { case 'user': return new User($data, $this->logger); } return parent::mapSubObjects($key, $data); }
protected function mapSubObjects(string $key, array $data) : TelegramTypes { switch ($key) { case 'thumb': return new PhotoSize($data, $this->logger); } return parent::mapSubObjects($key, $data); }
protected function mapSubObjects(string $key, array $data) : TelegramTypes { switch ($key) { case 'reply_markup': return new Markup($data, $this->logger); } return parent::mapSubObjects($key, $data); }
protected function mapSubObjects(string $key, array $data) : TelegramTypes { switch ($key) { case 'photos': return new UserProfilePhotosArray($data, $this->logger); } return parent::mapSubObjects($key, $data); }
protected function mapSubObjects(string $key, array $data) : TelegramTypes { switch ($key) { case 'from': return new User($data, $this->logger); case 'location': return new Location($data, $this->logger); } return parent::mapSubObjects($key, $data); }
protected function mapSubObjects(string $key, array $data) : TelegramTypes { switch ($key) { case 'message': case 'edited_message': return new Message($data, $this->logger); case 'inline_query': return new Query($data, $this->logger); case 'chosen_inline_result': return new ChosenResult($data, $this->logger); case 'callback_query': return new CallbackQuery($data, $this->logger); } return parent::mapSubObjects($key, $data); }
/** * A message may contain one or more subobjects, map them always in this function * * @param string $key * @param array $data * @return TelegramTypes */ protected function mapSubObjects(string $key, array $data) : TelegramTypes { switch ($key) { case 'from': case 'forward_from': case 'new_chat_participant': case 'left_chat_participant': return new User($data, $this->logger); case 'photo': case 'new_chat_photo': return new PhotoSizeArray($data, $this->logger); case 'chat': case 'forward_from_chat': return new Chat($data, $this->logger); case 'reply_to_message': case 'pinned_message': return new Message($data, $this->logger); case 'entities': return new MessageEntityArray($data, $this->logger); case 'audio': return new Audio($data, $this->logger); case 'document': return new Document($data, $this->logger); case 'sticker': return new Sticker($data, $this->logger); case 'video': return new Video($data, $this->logger); case 'voice': return new Voice($data, $this->logger); case 'contact': return new Contact($data, $this->logger); case 'location': return new Location($data, $this->logger); case 'venue': return new Venue($data, $this->logger); } // Return always null if none of the objects above matches return parent::mapSubObjects($key, $data); }