private function convertQuestion(Question $question)
    {
        $buttons = $question->getButtons();
        if ($buttons) {
            return [
                [
                    'type' => 'suggested',
                    'responses' => Collection::make($buttons)->transform(function ($button) {
                        $buttonData = [
                            'type' => 'text',
                            'metadata' => [
                                'value' => $button['value'],
                            ],
                        ];
                        if ($button['image_url']) {
                            $buttonData['type'] = 'picture';
                            $buttonData['picUrl'] = $button['image_url'];
                        } else {
                            $buttonData['body'] = $button['text'];
                        }

                        return $buttonData;
                    })->toArray(),
                ],
            ];
        } else {
            return [[]];
        }
    }
private function convertQuestion(Question $question)
    {
        $buttons = $question->getButtons();
        if ($buttons) {
            return [
                [
                    'type' => 'suggested',
                    'responses' => Collection::make($buttons)->transform(function ($button) {
                        $buttonData = [
                            'type' => 'text',
                            'metadata' => [
                                'value' => $button['value'],
                            ],
                        ];
                        if ($button['image_url']) {
                            $buttonData['type'] = 'picture';
                            $buttonData['picUrl'] = $button['image_url'];
                        } else {
                            $buttonData['body'] = $button['text'];
                        }

                        return $buttonData;
                    })->toArray(),
                ],
            ];
        } else {
            return [[]];
        }
    }
private function convertQuestion ( Question $ question ) { $ buttons = $ question -> getButtons ( ) ; if ( $ buttons ) { return [ [ 'type' => 'suggested' , 'responses' => Collection :: make ( $ buttons ) -> transform ( function ( $ button ) { $ buttonData = [ 'type' => 'text' , 'metadata' => [ 'value' => $ button [ 'value' ] , ] , ] ; if ( $ button [ 'image_url' ] ) { $ buttonData [ 'type' ] = 'picture' ; $ buttonData [ 'picUrl' ] = $ button [ 'image_url' ] ; } else { $ buttonData [ 'body' ] = $ button [ 'text' ] ; } return $ buttonData ; } ) -> toArray ( ) , ] , ] ; } else { return [ [ ] ] ; } }
Convert a Question object into a valid Kik
keyboard object.

@param \BotMan\BotMan\Messages\Outgoing\Question $question
@return array
Convert a Question object into a valid Kik keyboard object .