public function testComplexType() { $builder = new Builder('foo'); $builder->complexType('foo'); $builder->complexType(Property::getComplex('bar')); $builder->complexType('baz', Property::getComplex('foo')); $property = $builder->getProperty(); $this->assertInstanceOf('PSX\\Data\\Schema\\Property\\ComplexType', $property->get('foo')); $this->assertInstanceOf('PSX\\Data\\Schema\\Property\\ComplexType', $property->get('bar')); $this->assertInstanceOf('PSX\\Data\\Schema\\Property\\ComplexType', $property->get('baz')); }
/** * @param string $name * @param \PSX\Data\Schema\Property\ComplexType $template * @return \PSX\Data\Schema\Property\ComplexType */ public function complexType($name, Property\ComplexType $template = null) { if ($template === null) { if ($name instanceof Property\ComplexType) { $this->add($property = $name); } else { $this->add($property = Property::getComplex($name)); } } else { $property = clone $template; $property->setName($name); $this->add($property); } return $property; }