| Conditions | 3 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 13 | public function serialize(Command $command) |
||
| 14 | { |
||
| 15 | $xml = new DomDocument('1.0', 'utf-8'); |
||
| 16 | $xml->formatOutput = true; |
||
| 17 | $xml->preserveWhiteSpace = false; |
||
| 18 | |||
| 19 | $commandNode = $xml->createElement(ucfirst($command->getName())); |
||
| 20 | $commandNode->appendChild($xml->createElement('Key', $command->getApiKey())); |
||
| 21 | |||
| 22 | $requestBodyNodes = $this->builderFactory |
||
| 23 | ->createRequest($command, $this->getFormat()) |
||
| 24 | ->build(); |
||
| 25 | |||
| 26 | if ($requestBodyNodes !== null) { |
||
| 27 | foreach ($requestBodyNodes as $node) { |
||
| 28 | $commandNode->appendChild( |
||
| 29 | $xml->importNode(dom_import_simplexml($node), true) |
||
| 30 | ); |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | $xml->appendChild($commandNode); |
||
| 35 | |||
| 36 | return $xml->saveXML(); |
||
| 37 | } |
||
| 38 | |||
| 44 |