protected function renderV1()
    {
        if ('google' == $this->requestSource) {
            $out = [
                'type'     => 'basic_card',
                'platform' => $this->requestSource,
                'title'    => $this->title,
            ];

            if (! $this->text && ! $this->imageUrl) {
                $out['formattedText'] = ' '; // AoG requires text or image in card
            }

            if ($this->text) {
                $out['formattedText'] = $this->text;
            }

            if ($this->imageUrl) {
                $out['image'] = [
                    'url'               => $this->imageUrl,
                    'accessibilityText' => 'accessibility text',
                ];
            }

            if ($this->buttons) {
                $out['buttons'] = [];
                foreach ($this->buttons as $button) {
                    $out['buttons'][] =
                        [
                            'title'         => $button['buttonText'],
                            'openUrlAction' => [
                                'url' => $button['buttonUrl'],
                            ],
                        ];
                }
            }

            return $out;
        } else {
            $out = [
                'type'  => self::v1MessageObjectCard,
                'title' => $this->title,
            ];

            if ($this->text) {
                $out['subtitle'] = $this->text;
            }
            if ($this->imageUrl) {
                $out['imageUrl'] = $this->imageUrl;
            }

            // this is required in the response even if there are no buttons for some reason
            if ('slack' == $this->requestSource) {
                $out['buttons'] = [];
            }

            if ($this->buttons) {
                $out['buttons'] = [];
                foreach ($this->buttons as $button) {
                    $out['buttons'][] =
                        [
                            'text'     => $button['buttonText'],
                            'postback' => $button['buttonUrl'],
                        ];
                }
            }

            $out['platform'] = $this->requestSource;

            return $out;
        }
    }
protected function renderV1()
    {
        if ('google' == $this->requestSource) {
            $out = [
                'type'     => 'basic_card',
                'platform' => $this->requestSource,
                'title'    => $this->title,
            ];

            if (! $this->text && ! $this->imageUrl) {
                $out['formattedText'] = ' '; 
            }

            if ($this->text) {
                $out['formattedText'] = $this->text;
            }

            if ($this->imageUrl) {
                $out['image'] = [
                    'url'               => $this->imageUrl,
                    'accessibilityText' => 'accessibility text',
                ];
            }

            if ($this->buttons) {
                $out['buttons'] = [];
                foreach ($this->buttons as $button) {
                    $out['buttons'][] =
                        [
                            'title'         => $button['buttonText'],
                            'openUrlAction' => [
                                'url' => $button['buttonUrl'],
                            ],
                        ];
                }
            }

            return $out;
        } else {
            $out = [
                'type'  => self::v1MessageObjectCard,
                'title' => $this->title,
            ];

            if ($this->text) {
                $out['subtitle'] = $this->text;
            }
            if ($this->imageUrl) {
                $out['imageUrl'] = $this->imageUrl;
            }

            
            if ('slack' == $this->requestSource) {
                $out['buttons'] = [];
            }

            if ($this->buttons) {
                $out['buttons'] = [];
                foreach ($this->buttons as $button) {
                    $out['buttons'][] =
                        [
                            'text'     => $button['buttonText'],
                            'postback' => $button['buttonUrl'],
                        ];
                }
            }

            $out['platform'] = $this->requestSource;

            return $out;
        }
    }
protected function renderV1 ( ) { if ( 'google' == $ this -> requestSource ) { $ out = [ 'type' => 'basic_card' , 'platform' => $ this -> requestSource , 'title' => $ this -> title , ] ; if ( ! $ this -> text && ! $ this -> imageUrl ) { $ out [ 'formattedText' ] = ' ' ; // AoG requires text or image in card } if ( $ this -> text ) { $ out [ 'formattedText' ] = $ this -> text ; } if ( $ this -> imageUrl ) { $ out [ 'image' ] = [ 'url' => $ this -> imageUrl , 'accessibilityText' => 'accessibility text' , ] ; } if ( $ this -> buttons ) { $ out [ 'buttons' ] = [ ] ; foreach ( $ this -> buttons as $ button ) { $ out [ 'buttons' ] [ ] = [ 'title' => $ button [ 'buttonText' ] , 'openUrlAction' => [ 'url' => $ button [ 'buttonUrl' ] , ] , ] ; } } return $ out ; } else { $ out = [ 'type' => self :: v1MessageObjectCard , 'title' => $ this -> title , ] ; if ( $ this -> text ) { $ out [ 'subtitle' ] = $ this -> text ; } if ( $ this -> imageUrl ) { $ out [ 'imageUrl' ] = $ this -> imageUrl ; } // this is required in the response even if there are no buttons for some reason if ( 'slack' == $ this -> requestSource ) { $ out [ 'buttons' ] = [ ] ; } if ( $ this -> buttons ) { $ out [ 'buttons' ] = [ ] ; foreach ( $ this -> buttons as $ button ) { $ out [ 'buttons' ] [ ] = [ 'text' => $ button [ 'buttonText' ] , 'postback' => $ button [ 'buttonUrl' ] , ] ; } } $ out [ 'platform' ] = $ this -> requestSource ; return $ out ; } }
Render response as array for API V1.

@return array
Render response as array for API V1 .