public static function getChangeSubscriptionXml($timeframe, $newPlanCode, $newQuantity, $newUnitAmount, $add_ons) { $doc = new DOMDocument("1.0"); $root = $doc->appendChild($doc->createElement("subscription")); $root->appendChild($doc->createElement("timeframe", $timeframe)); if ($newPlanCode != null) { $root->appendChild($doc->createElement("plan_code", $newPlanCode)); } if ($newQuantity != null) { $root->appendChild($doc->createElement("quantity", $newQuantity)); } if ($newUnitAmount != null) { $root->appendChild($doc->createElement("unit_amount", $newUnitAmount)); } if (isset($add_ons)) { $root->appendChild(RecurlySubscription::getAddOnsXml($add_ons, $doc)); } return $doc->saveXML(); }