本文整理匯總了PHP中Guzzle\Service\Description\Parameter::getParent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Parameter::getParent方法的具體用法?PHP Parameter::getParent怎麽用?PHP Parameter::getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Guzzle\Service\Description\Parameter
的用法示例。
在下文中一共展示了Parameter::getParent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: visit
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;
}
示例2: visit
/**
* {@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;
}
示例3: testCanChangeParentOfNestedParameter
public function testCanChangeParentOfNestedParameter()
{
$param1 = new Parameter(array('name' => 'parent'));
$param2 = new Parameter(array('name' => 'child'));
$param2->setParent($param1);
$this->assertSame($param1, $param2->getParent());
}