本文整理汇总了PHP中Guzzle\Service\Description\Parameter::setParent方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameter::setParent方法的具体用法?PHP Parameter::setParent怎么用?PHP Parameter::setParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Service\Description\Parameter
的用法示例。
在下文中一共展示了Parameter::setParent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCanAddArrayOfSimpleTypes
public function testCanAddArrayOfSimpleTypes()
{
$request = new EntityEnclosingRequest('POST', 'http://foo.com');
$visitor = new XmlVisitor();
$param = new Parameter(array('type' => 'object', 'location' => 'xml', 'name' => 'Out', 'properties' => array('Nodes' => array('required' => true, 'type' => 'array', 'min' => 1, 'items' => array('type' => 'string', 'sentAs' => 'Node')))));
$param->setParent(new Operation(array('data' => array('xmlRoot' => array('name' => 'Test', 'namespaces' => array('https://foo/'))))));
$value = array('Nodes' => array('foo', 'baz'));
$this->assertTrue($this->validator->validate($param, $value));
$visitor->visit($this->command, $request, $param, $value);
$visitor->after($this->command, $request);
$this->assertEquals("<?xml version=\"1.0\"?>\n" . "<Test xmlns=\"https://foo/\"><Out><Nodes><Node>foo</Node><Node>baz</Node></Nodes></Out></Test>\n", (string) $request->getBody());
}
示例2: addParam
/**
* Add a parameter to the command
*
* @param Parameter $param Parameter to add
*
* @return self
*/
public function addParam(Parameter $param)
{
$this->parameters[$param->getName()] = $param;
$param->setParent($this);
return $this;
}
示例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());
}
示例4: addProperty
/**
* Add a property to the parameter
*
* @param Parameter $property Properties to set
*
* @return self
*/
public function addProperty(Parameter $property)
{
$this->properties[$property->getName()] = $property;
$property->setParent($this);
$this->propertiesCache = null;
return $this;
}
示例5: setAdditionalProperties
/**
* Set the additionalProperties value of the parameter
*
* @param bool|Parameter|null $additional Boolean to allow any, an Parameter to specify a schema, or false to disallow
*
* @return self
*/
public function setAdditionalProperties($additional)
{
$this->additionalProperties = $additional;
if ($additional instanceof self) {
$additional->setParent($this);
}
return $this;
}