parse() public method

Parse XML string into PHP representation
public parse ( string $xmlString ) : mixed
$xmlString string
return mixed
Beispiel #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 testEmptyStructMember()
 {
     $string = '<?xml version="1.0" encoding="UTF-8"?>
         <methodResponse>
             <params>
                 <param>
                     <value>
                         <struct>
                             <member>
                                 <name>FIRST</name>
                                 <value></value>
                             </member>
                         </struct>
                     </value>
                 </param>
             </params>
         </methodResponse>';
     $isFault = false;
     $this->assertSame(array('FIRST' => ''), $this->parser->parse($string, $isFault));
     $this->assertFalse($isFault);
 }
 public function testThrowExceptionWhenIsString()
 {
     $string = 'returned string';
     $this->setExpectedException('fXmlRpc\\Exception\\ParserException', 'Invalid XML. Expected XML, string given: "returned string"');
     $this->parser->parse($string);
 }