encode() public method

Converts a PHP array into an OPS message.
public encode ( $array ) : string
return string OPS XML message
Beispiel #1
0
 /**
  * Should convert php arrays to valid xml.
  */
 public function testEncode()
 {
     $ops = new Ops();
     $data = array('protocol' => '', 'action' => '', 'object' => '');
     $result = $ops->encode($data);
     $xml = XMLReader::xml($result);
     // The validate parser option must be enabled for
     // this method to work properly
     $xml->setParserProperty(XMLReader::VALIDATE, true);
     // make sure this is xml
     $this->assertTrue($xml->isValid());
 }