PayPal\PayPalAPI\BMCreateButtonRequestType::toXMLString PHP Method

toXMLString() public method

public toXMLString ( )
    public function toXMLString()
    {
        $flag = 0;
        foreach ($this->ButtonVar as $var) {
            if (strpos($var, 'bn=') !== false) {
                $flag = 1;
                break;
            }
        }
        if (!$flag) {
            array_push($this->ButtonVar, "bn=PayPal_SDK");
        }
        return parent::toXMLString();
    }

Usage Example

 public function toXMLString()
 {
     $str = '';
     $str .= '<ns:BMCreateButtonReq>';
     if ($this->BMCreateButtonRequest != null) {
         $str .= '<ns:BMCreateButtonRequest>';
         $str .= $this->BMCreateButtonRequest->toXMLString();
         $str .= '</ns:BMCreateButtonRequest>';
     }
     $str .= '</ns:BMCreateButtonReq>';
     return $str;
 }
BMCreateButtonRequestType