Longman\TelegramBot\Entities\ServerResponse::createResultObject PHP Метод

createResultObject() приватный Метод

Create and return the object of the received result
private createResultObject ( array $result, string $bot_name ) : Chat | ChatMember | Longman\TelegramBot\Entities\File | Message | Longman\TelegramBot\Entities\User | UserProfilePhotos | Longman\TelegramBot\Entities\WebhookInfo
$result array
$bot_name string
Результат Chat | ChatMember | Longman\TelegramBot\Entities\File | Message | Longman\TelegramBot\Entities\User | UserProfilePhotos | Longman\TelegramBot\Entities\WebhookInfo
    private function createResultObject($result, $bot_name)
    {
        // We don't need to save the raw_data of the response object!
        $result['raw_data'] = null;
        $result_object_types = ['total_count' => 'UserProfilePhotos', 'file_id' => 'File', 'title' => 'Chat', 'username' => 'User', 'user' => 'ChatMember', 'url' => 'WebhookInfo'];
        foreach ($result_object_types as $type => $object_class) {
            if (isset($result[$type])) {
                $object_class = __NAMESPACE__ . '\\' . $object_class;
                return new $object_class($result);
            }
        }
        //Response from sendMessage
        return new Message($result, $bot_name);
    }