src/Broadcast/MessageBuilder.php
public function build()
    {
        if (empty($this->msgType)) {
            throw new RuntimeException('message type not exist.');
        }

        if (empty($this->message)) {
            throw new RuntimeException('No message content to send.');
        }

        // 群发视频消息给用户列表时，视频消息格式需要另外处理，具体见文档
        if ($this->msgType === Broadcast::MSG_TYPE_VIDEO) {
            if (is_array($this->message)) {
                $this->message = array_shift($this->message);
            }
            $this->msgType = 'mpvideo';
        }

        $content = (new Transformer($this->msgType, $this->message))->transform();

        $group = isset($this->to) ? $this->to : null;

        $message = array_merge($this->buildGroup($group), $content);

        return $message;
    }
public function build()
    {
        if (empty($this->msgType)) {
            throw new RuntimeException('message type not exist.');
        }

        if (empty($this->message)) {
            throw new RuntimeException('No message content to send.');
        }

        // 群发视频消息给用户列表时，视频消息格式需要另外处理，具体见文档
        if ($this->msgType === Broadcast::MSG_TYPE_VIDEO) {
            if (is_array($this->message)) {
                $this->message = array_shift($this->message);
            }
            $this->msgType = 'mpvideo';
        }

        $content = (new Transformer($this->msgType, $this->message))->transform();

        $group = isset($this->to) ? $this->to : null;

        $message = array_merge($this->buildGroup($group), $content);

        return $message;
    }
Build message.

@return bool

@throws RuntimeException