private function fillItem(Item $element, DOMElement $node)
 {
     $localType = null;
     foreach ($node->childNodes as $childNode) {
         switch ($childNode->localName) {
             case 'complexType':
             case 'simpleType':
                 $localType = $childNode;
                 break 2;
         }
     }
     if ($localType) {
         $addCallback = function ($type) use($element) {
             $element->setType($type);
         };
         switch ($localType->localName) {
             case 'complexType':
                 call_user_func($this->loadComplexType($element->getSchema(), $localType, $addCallback));
                 break;
             case 'simpleType':
                 call_user_func($this->loadSimpleType($element->getSchema(), $localType, $addCallback));
                 break;
         }
     } else {
         if ($node->getAttribute("type")) {
             $type = $this->findSomething('findType', $element->getSchema(), $node, $node->getAttribute("type"));
         } else {
             $type = $this->findSomething('findType', $element->getSchema(), $node, $node->lookupPrefix(self::XSD_NS) . ":anyType");
         }
         $element->setType($type);
     }
 }
Example #2
0
 private function findPHPClass(&$class, Item $node)
 {
     $type = $node->getType();
     if ($alias = $this->getTypeAlias($node->getType())) {
         return $alias;
     }
     if ($node instanceof ElementRef) {
         $elementRef = $this->visitElementDef($node->getSchema(), $node->getReferencedElement());
         return key($elementRef);
     }
     if ($valueProp = $this->typeHasValue($type, $class, '')) {
         return $valueProp;
     }
     if (!$node->getType()->getName()) {
         $visited = $this->visitTypeAnonymous($node->getType(), $node->getName(), $class);
     } else {
         $visited = $this->visitType($node->getType());
     }
     return key($visited);
 }