/** * @expectedException \InvalidArgumentException */ public function testSetModelBasNameOneAttributeWithException() { $struct = new StructModel(self::bingGeneratorInstance(), 'Foo'); $struct->addAttribute('bar', 'string'); $array = new ArrayFile(self::bingGeneratorInstance(), 'Foo'); $array->setModel($struct); }
/** * @param Tag $parent * @param Struct $struct * @param AttributeHandler $attribute */ private function parseRestrictionAttribute(Tag $parent, Struct $struct, AttributeHandler $attribute) { if ($attribute->getName() === 'base' && $attribute->getValue() !== $parent->getAttributeName()) { $struct->setInheritance($attribute->getValue()); } else { $struct->addMeta($attribute->getName(), $attribute->getValue(true)); } }
/** * @param StructModel $struct * @return StructEnumFile|StructArrayFile|StructFile */ private function getStructFile(StructModel $struct) { if ($struct->getisRestriction()) { $file = new StructEnumFile($this->generator, $struct->getPackagedName()); } elseif ($struct->isArray()) { $file = new StructArrayFile($this->generator, $struct->getPackagedName()); } else { $file = new StructFile($this->generator, $struct->getPackagedName()); } return $file; }
/** * work around for https://bugs.php.net/bug.php?id=69280 * @param StructModel $struct * @return ClassMap */ protected function getStructName(StructModel $struct) { return substr($struct->getPackagedName(true), $struct->getNamespace() != '' ? 1 : 0); }