private function visitSimpleType(PHPClass $class, SimpleType $type) { if ($restriction = $type->getRestriction()) { $parent = $restriction->getBase(); if ($parent instanceof Type) { $this->handleClassExtension($class, $parent); } foreach ($restriction->getChecks() as $typeCheck => $checks) { foreach ($checks as $check) { $class->addCheck('__value', $typeCheck, $check); } } } elseif ($unions = $type->getUnions()) { $types = array(); foreach ($unions as $i => $unon) { if (!$unon->getName()) { $types[] = $this->visitTypeAnonymous($unon, $type->getName() . $i, $class); } else { $types[] = $this->visitType($unon); } } if ($candidato = reset($types)) { $class->setExtends($candidato); } } }
private function visitSimpleType(&$class, &$data, SimpleType $type, $name) { if ($restriction = $type->getRestriction()) { $parent = $restriction->getBase(); if ($parent instanceof Type) { $this->handleClassExtension($class, $data, $parent, $name); } } elseif ($unions = $type->getUnions()) { foreach ($unions as $i => $unon) { $this->handleClassExtension($class, $data, $unon, $name . $i); break; } } }