Goetas\Xsd\XsdToPhp\Php\PhpConverter::visitSimpleType PHP Method

visitSimpleType() private method

private visitSimpleType ( PHPClass $class, GoetasWebservices\XML\XSDReader\Schema\Type\SimpleType $type )
$class Goetas\Xsd\XsdToPhp\Php\Structure\PHPClass
$type GoetasWebservices\XML\XSDReader\Schema\Type\SimpleType
    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);
            }
        }
    }