Ejemplo n.º 1
0
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
{
$xml = isset($this->data[$command])
? $this->data[$command]
: $this->createRootElement($param->getParent());
$this->addXml($xml, $param, $value);

$this->data[$command] = $xml;
}
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  * @throws RuntimeException
  */
 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     if (isset($this->data[$command])) {
         $xml = $this->data[$command];
     } elseif ($parent = $param->getParent()) {
         $xml = $this->createRootElement($parent);
     } else {
         throw new RuntimeException('Parameter does not have a parent');
     }
     $node = $xml;
     if (!$param->getData('xmlFlattened') && ($param->getType() == 'object' || $param->getType() == 'array')) {
         $node = $xml->addChild($param->getWireName());
     }
     $this->addXml($node, $param, $value);
     $this->data[$command] = $xml;
 }
Ejemplo n.º 3
0
 public function testCanChangeParentOfNestedParameter()
 {
     $param1 = new Parameter(array('name' => 'parent'));
     $param2 = new Parameter(array('name' => 'child'));
     $param2->setParent($param1);
     $this->assertSame($param1, $param2->getParent());
 }