protected function makePayload($data)
    {
        if ($this->isNotSetOrEmpty($data)) {
            return $this;
        }

        switch ($this->payload['type']) {
            case ButtonType::WEB_URL:
                $this->url($data);
                break;
            case ButtonType::PHONE_NUMBER:
                $this->phone($data);
                break;
            case ButtonType::POSTBACK:
                $this->postback($data);
                break;
        }

        if (isset($this->payload['payload']) && mb_strlen($this->payload['payload']) > 1000) {
            throw CouldNotCreateButton::payloadLimitExceeded($this->payload['payload']);
        }

        return $this;
    }
protected function makePayload($data)
    {
        if ($this->isNotSetOrEmpty($data)) {
            return $this;
        }

        switch ($this->payload['type']) {
            case ButtonType::WEB_URL:
                $this->url($data);
                break;
            case ButtonType::PHONE_NUMBER:
                $this->phone($data);
                break;
            case ButtonType::POSTBACK:
                $this->postback($data);
                break;
        }

        if (isset($this->payload['payload']) && mb_strlen($this->payload['payload']) > 1000) {
            throw CouldNotCreateButton::payloadLimitExceeded($this->payload['payload']);
        }

        return $this;
    }
protected function makePayload ( $ data ) { if ( $ this -> isNotSetOrEmpty ( $ data ) ) { return $ this ; } switch ( $ this -> payload [ 'type' ] ) { case ButtonType :: WEB_URL : $ this -> url ( $ data ) ; break ; case ButtonType :: PHONE_NUMBER : $ this -> phone ( $ data ) ; break ; case ButtonType :: POSTBACK : $ this -> postback ( $ data ) ; break ; } if ( isset ( $ this -> payload [ 'payload' ] ) && mb_strlen ( $ this -> payload [ 'payload' ] ) > 1000 ) { throw CouldNotCreateButton :: payloadLimitExceeded ( $ this -> payload [ 'payload' ] ) ; } return $ this ; }
Make payload by data and type.

@param mixed $data

@return $this
@throws CouldNotCreateButton
Make payload by data and type .