public function getItemName(Item $item)
 {
     $name = $this->classify($item->getName());
     if (in_array(strtolower($name), $this->reservedWords)) {
         $name .= 'Xsd';
     }
     return $name;
 }
 /**
  * @param Item $item
  * @return string
  */
 public function getPropertyName($item)
 {
     return Inflector::camelize(str_replace(".", " ", $item->getName()));
 }
Beispiel #3
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);
     }
 }
Beispiel #4
0
 public function getItemName(Item $item)
 {
     return $this->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);
     }
 }
 public function __construct(AttributeDef $att)
 {
     parent::__construct($att->getSchema(), $att->getName());
     $this->wrapped = $att;
 }
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);
 }
 public function __construct(ElementDef $element)
 {
     parent::__construct($element->getSchema(), $element->getName());
     $this->wrapped = $element;
 }