Serialize the WebsiteConfig object into xml string.

@return string
@throws OssException
2285
public function serializeToXml()
    {
        $xml = new \SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><WebsiteConfiguration></WebsiteConfiguration>');
        $index_document_part = $xml->addChild('IndexDocument');
        $error_document_part = $xml->addChild('ErrorDocument');
        $index_document_part->addChild('Suffix', $this->indexDocument);
        $error_document_part->addChild('Key', $this->errorDocument);
        return $xml->asXML();
    }
762871
public function xml()
    {
        if (empty($this->_result)) {
            return $this->xml->getSimpleXmlElement();
        }
        $hideRaids = array();
        if (defined('PSI_PLUGIN_RAID_HIDE_DEVICES') && is_string(PSI_PLUGIN_RAID_HIDE_DEVICES)) {
            if (preg_match(ARRAY_EXP, PSI_PLUGIN_RAID_HIDE_DEVICES)) {
                $hideRaids = eval(PSI_PLUGIN_RAID_HIDE_DEVICES);
            } else {
                $hideRaids = array(PSI_PLUGIN_RAID_HIDE_DEVICES);
            }
        }
        foreach ($this->_result['devices'] as $key=>$device) {
            if (!in_array(ltrim($key, "/"), $hideRaids, true)) {
                $dev = $this->xml->addChild("Raid");
                $dev->addAttribute("Device_Name", ltrim($key, "/")); //for megactl and megasasctl conflicts
                $dev->addAttribute("Program", $device["prog"]);
                if (isset($device['level'])) $dev->addAttribute("Level", strtolower($device["level"]));
                $dev->addAttribute("Status", strtolower($device["status"]));
                if (isset($device['name'])) $dev->addAttribute("Name", $device["name"]);
                if (isset($device['size'])) $dev->addAttribute("Size", $device["size"]);
                if (isset($device['stride'])) $dev->addAttribute("Stride", $device["stride"]);
                if (isset($device['subsets'])) $dev->addAttribute("Subsets", $device["subsets"]);
                if (isset($device['devs'])) $dev->addAttribute("Devs", $device["devs"]);
                if (isset($device['spares'])) $dev->addAttribute("Spares", $device["spares"]);

                if (isset($device['chunk_size'])) $dev->addAttribute("Chunk_Size", $device["chunk_size"]);
                if (isset($device['pers_superblock'])) $dev->addAttribute("Persistend_Superblock", $device["pers_superblock"]);
                if (isset($device['algorithm'])) $dev->addAttribute("Algorithm", $device["algorithm"]);
                if (isset($device['registered'])) $dev->addAttribute("Disks_Registered", $device["registered"]);
                if (isset($device['active'])) $dev->addAttribute("Disks_Active", $device["active"]);
                if (isset($device['controller'])) $dev->addAttribute("Controller", $device["controller"]);
                if (isset($device['battery'])) $dev->addAttribute("Battery", $device["battery"]);
                if (isset($device['supported'])) $dev->addAttribute("Supported", $device["supported"]);
                if (isset($device['readpolicy'])) $dev->addAttribute("ReadPolicy", $device["readpolicy"]);
                if (isset($device['writepolicy'])) $dev->addAttribute("WritePolicy", $device["writepolicy"]);
                if (isset($device['cache_size'])) $dev->addAttribute("Cache_Size", $device["cache_size"]);
                if (isset($device['bad_blocks'])) $dev->addAttribute("Bad_Blocks", $device["bad_blocks"]);

                if (isset($device['action'])) {
                    $action = $dev->addChild("Action");
                    $action->addAttribute("Name", $device['action']['name']);
                    if (isset($device['action']['percent'])) $action->addAttribute("Percent", $device['action']['percent']);

                    if (isset($device['action']['finish_time'])) $action->addAttribute("Time_To_Finish", $device['action']['finish_time']);
                    if (isset($device['action']['finish_unit'])) $action->addAttribute("Time_Unit", $device['action']['finish_unit']);

                }
                $disks = $dev->addChild("RaidItems");
                if (isset($device['items']) && (sizeof($device['items'])>0)) foreach ($device['items'] as $disk) {
                    if (isset($disk['name'])) {
                        $disktemp = $disks->addChild("Item");
                        $disktemp->addAttribute("Name", $disk['name']);
                        // if (isset($disk['raid_index'])) $disktemp->addAttribute("Index", $disk['raid_index']);
                        if (isset($disk['parentid'])) $disktemp->addAttribute("ParentID", $disk['parentid']);
                        if (isset($disk['type'])) $disktemp->addAttribute("Type", $disk['type']);
                        // if (in_array(strtolower($device["status"]), array('ok', 'optimal', 'active', 'online', 'degraded'))) {
                            $disktemp->addAttribute("Status", $disk['status']);
                        //} else {
                        //    $disktemp->addAttribute("Status", "W");
                        //}
                        if (isset($disk['info'])) $disktemp->addAttribute("Info", $disk['info']);
                    }
                }
            }
        }

        return $this->xml->getSimpleXmlElement();
    }
851527
public function to_xml() {
        $this->validate();
        foreach ($this->entries as $entry) {
            $entry->id = 'portfolio:' . $entry->id;
            $this->feed->appendChild($entry->to_dom($this->dom, $this->user));
        }
        return $this->dom->saveXML();
    }
1230644
public function toString()
    {
        $parts = [];
        $data = $this->data();
        $parts[] = $data['name'] . '=' . rawurlencode($data['value']);

        if ($data['domain']) {
            $parts[] = 'Domain=' . $data['domain'];
        }
        if ($data['path']) {
            $parts[] = 'Path=' . $data['path'];
        }
        if (isset($data['max-age'])) {
            $parts[] = 'Max-Age=' . (string) $data['max-age'];
        } elseif (isset($data['expires'])) {
            $parts[] = 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $data['expires']);
        }
        if ($data['secure']) {
            $parts[] = 'Secure';
        }
        if ($data['httponly']) {
            $parts[] = 'HttpOnly';
        }
        return join('; ', $parts);
    }
1289633
protected function getXML()
    {
        $key = 'xml_' . md5($this->url); // Everybody loves md5!

        if ($this->cache->has($key)) {
            $this->xml = $this->cache->get($key);
        } else {
            $this->xml = $this->fetchXML();

            $this->xml = $this->changeLinkElements($this->xml);

            $this->cache->put($key, $this->xml, $this->cacheTime);
        }
    }
1065114
public function ToString()
	{
		if ( is_null( $this->domNode ) ) return "";
		if ( $this->domNode instanceof \DOMDocument )
		{
			$result = $this->domNode->saveXML( null );
			// Remove any initial PI
			$result = preg_replace( "/^<\?xml.*\?>\s/", "", $result );
			return $result;
		}
		else
		{
			// InnerXml?
			// return array_reduce(
			// 	iterator_to_array( $this->domNode->childNodes ),
			// 	function ( $carry, /** @var \DOMNode */ $child )
			// 	{
			// 		return $carry.$child->ownerDocument->saveXML( $child );
			// 	}
			// );
			$result = $this->domNode->ownerDocument->SaveXML( $this->domNode );
			return $result;
		}
	}
965781
public function toXML()
    {
        $xml = "";
        $xml .= "<CaptureNotification xmlns=\"";
        $xml .= self::getNamespace();
        $xml .= "\">";
        $xml .= $this->_toXMLFragment();
        $xml .= "</CaptureNotification>";
        return $xml;
    }
157012
protected function parseDataFromResponse()
    {
        $content = $this->rawResponse->body;
        $config = new WebsiteConfig();
        $config->parseFromXml($content);
        return $config;
    }
1337478
public function toString()
    {
        $doc = new DOMDocument('1.0');
        $doc->formatOutput = true;
        $this->appendXml($doc);
        $xmlstr = $doc->saveXML();

        return trim(preg_replace('/<\?xml.*?\?>/', '', $xmlstr));
    }
159744
public function toString()
    {
        $headers = $this->toArray();
        $content = '';

        //Serialise the headers to a string
        foreach ($headers as $name => $value) {
            $content .= sprintf("%s %s\r\n", $name.':', $value);
        }

        return $content;
    }
224634
public function toXML()
    {
        $dom = new DOMDocument( '1.0', 'utf-8' );
        $dom->formatOutput = true;
        $success = $dom->loadXML('<page />');

        $pageNode = $dom->documentElement;

        foreach ( $this->attributes as $attrName => $attrValue )
        {
            switch ( $attrName )
            {
                case 'id':
                    $pageNode->setAttribute( 'id', $attrValue );
                    break;

                case 'zones':
                    foreach ( $this->attributes['zones'] as $zone )
                    {
                        $zoneNode = $zone->toXML( $dom );
                        $pageNode->appendChild( $zoneNode );
                    }
                    break;

                default:
                    $node = $dom->createElement( $attrName );
                    $nodeValue = $dom->createTextNode( $attrValue );
                    $node->appendChild( $nodeValue );
                    $pageNode->appendChild( $node );
                    break;
            }
        }

        return $dom->saveXML();
    }
907597
final public function serialize(): string
    {
        $vars = array_filter(get_object_vars($this));
        $vars['adviceMethod'] = static::serializeAdvice($this->adviceMethod);

        return serialize($vars);
    }
1124355
private function propertiesToXml() {
        $properties = array();

        foreach (self::$properties[get_class($this)] as $name => $info) {
            if($info['attribute']) {
                continue;
            }

            if (!array_key_exists($name, $this->values)) {
                continue;
            }

            $value = $this->values[$name];

            if(!array_key_exists('elementName', $info) && !array_key_exists('attributeName', $info)) {
                $properties[] = self::encodeValueXml($value);
            }
            else {
                if ($info['unbound']) {
                    foreach($value as $property) {
                        $properties[] = self::propertyToXml($info['elementName'], $property);
                    }
                } else {
                    $properties[] = self::propertyToXml($info['elementName'], $value);
                }
            }
        }

        return join('', $properties);
    }
198184
public function toXML()
    {
        $xml = '<image:image>';

        $xml .= '<image:loc>' . Utils::encode($this->getLoc()) . '</image:loc>';

        if ($this->getCaption()) {
            $xml .= '<image:caption>' . Utils::render($this->getCaption()) . '</image:caption>';
        }

        if ($this->getGeoLocation()) {
            $xml .= '<image:geo_location>' . Utils::render($this->getGeoLocation()) . '</image:geo_location>';
        }

        if ($this->getTitle()) {
            $xml .= '<image:title>' . Utils::render($this->getTitle()) . '</image:title>';
        }

        if ($this->getLicense()) {
            $xml .= '<image:license>' . Utils::render($this->getLicense()) . '</image:license>';
        }

        $xml .= '</image:image>';

        return $xml;
    }
1362309
public function toString() : string
   {

      if ( empty( $this->_subDomainName ) )
      {

         if ( null === $this->_sld )
         {
            return '';
         }

         return $this->_sld->toString();

      }

      if ( null === $this->_sld )
      {
         return $this->_subDomainName;
      }

      return $this->_subDomainName . '.' . $this->_sld->toString();

   }
1046213
function xmlString( )
    {
        $doc = new DOMDocument( '1.0', 'utf-8' );

        $root = $doc->createElement( "ezoption" );
        $doc->appendChild( $root );

        $name = $doc->createElement( "name" );
        $name->appendChild( $doc->createCDATASection( $this->Name ) );
        $root->appendChild( $name );

        $options = $doc->createElement( "options" );
        $root->appendChild( $options );

        foreach ( $this->Options as $option )
        {
            $optionNode = $doc->createElement( "option" );
            $optionNode->appendChild( $doc->createCDATASection( $option["value"] ) );
            $optionNode->setAttribute( "id", $option['id'] );
            $optionNode->setAttribute( 'additional_price', $option['additional_price'] );
            $options->appendChild( $optionNode );
        }

        $xml = $doc->saveXML();

        return $xml;
    }
1251699
public function serialize()
	{
		$xmlString = sprintf(
			'<%s %s>%s</%1$s>',
			$this->_getRootNodeName(),
			$this->_serializeRootAttributes(),
			$this->_serializeContents()
		);
		$canonicalXml = $this->_helper->getPayloadAsDoc($xmlString)->C14N();
		return $this->_canSerialize() ? $canonicalXml : '';
	}