serialize() public method

Serialize XML/RPC method name and params into XML representation
public serialize ( string $method, array $params = [] ) : string
$method string
$params array
return string
Example #1
0
 /** {@inheritdoc} */
 public function call($methodName, array $params = [])
 {
     if (!is_string($methodName)) {
         throw InvalidArgumentException::expectedParameter(0, 'string', $methodName);
     }
     $params = array_merge($this->prependParams, $params, $this->appendParams);
     $payload = $this->serializer->serialize($methodName, $params);
     $response = $this->transport->send($this->uri, $payload);
     return $this->parser->parse($response);
 }
 public function testSerialeArray()
 {
     $xml = '<?xml version="1.0" encoding="UTF-8"?>
         <methodCall>
             <methodName>method</methodName>
             <params>
                 <param>
                     <value>
                         <struct>
                             <member>
                                 <name>_FCGI_</name>
                             <value>
                                 <string>some value</string>
                             </value>
                         </member>
                     </struct>
                 </value>
             </param>
         </params>
     </methodCall>';
     $this->assertXmlStringEqualsXmlString($xml, $this->serializer->serialize('method', [['_FCGI_' => 'some value']]));
 }