Beispiel #1
0
 public function __construct(ElementDef $element)
 {
     parent::__construct($element->getSchema(), $element->getName());
     $this->wrapped = $element;
 }
Beispiel #2
0
 private function findPHPClass(PHPClass $class, Item $node, $force = false)
 {
     if ($node instanceof ElementRef) {
         return $this->visitElementDef($node->getReferencedElement());
     }
     if (!$node->getType()->getName()) {
         return $this->visitTypeAnonymous($node->getType(), $node->getName(), $class);
     } else {
         return $this->visitType($node->getType(), $force);
     }
 }
 public function __construct(AttributeDef $att)
 {
     parent::__construct($att->getSchema(), $att->getName());
     $this->wrapped = $att;
 }
 public function getItemName(Item $item)
 {
     return $this->classify($item->getName());
 }
Beispiel #5
0
 public function getItemName(Item $item)
 {
     return Inflector::classify($item->getName());
 }
 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);
     }
 }
Beispiel #7
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);
 }