コード例 #1
0
ファイル: PhpConverter.php プロジェクト: jchoi926/php-ews
 private function visitAttribute(PHPClass $class, Schema $schema, AttributeItem $attribute, $arrayize = true)
 {
     $property = new PHPProperty();
     $property->setName(Inflector::camelize($attribute->getName()));
     if ($arrayize && ($itemOfArray = $this->isArrayType($attribute->getType()))) {
         if ($attribute->getType()->getName()) {
             $arg = new PHPArg(Inflector::camelize($attribute->getName()));
             $arg->setType($this->visitType($itemOfArray));
             $property->setType(new PHPClassOf($arg));
         } else {
             $property->setType($this->visitTypeAnonymous($attribute->getType(), $attribute->getName(), $class));
         }
     } else {
         $property->setType($this->findPHPClass($class, $attribute, true));
     }
     $property->setDoc($attribute->getDoc());
     return $property;
 }
コード例 #2
0
ファイル: YamlConverter.php プロジェクト: Garethp/xsd2php
 private function visitAttribute(&$class, Schema $schema, AttributeItem $attribute)
 {
     $property = array();
     $property["expose"] = true;
     $property["access_type"] = "public_method";
     $property["serialized_name"] = $attribute->getName();
     $property["accessor"]["getter"] = "get" . Inflector::classify($attribute->getName());
     $property["accessor"]["setter"] = "set" . Inflector::classify($attribute->getName());
     $property["xml_attribute"] = true;
     if ($alias = $this->getTypeAlias($attribute)) {
         $property["type"] = $alias;
     } elseif ($itemOfArray = $this->isArrayType($attribute->getType())) {
         if ($valueProp = $this->typeHasValue($itemOfArray, $class, 'xx')) {
             $property["type"] = "Goetas\\Xsd\\XsdToPhp\\Jms\\SimpleListOf<" . $valueProp . ">";
         } else {
             $property["type"] = "Goetas\\Xsd\\XsdToPhp\\Jms\\SimpleListOf<" . $this->findPHPName($itemOfArray) . ">";
         }
         $property["xml_list"]["inline"] = false;
         $property["xml_list"]["entry_name"] = $itemOfArray->getName();
         if ($schema->getTargetNamespace()) {
             $property["xml_list"]["entry_namespace"] = $schema->getTargetNamespace();
         }
     } else {
         $property["type"] = $this->findPHPClass($class, $attribute);
     }
     return $property;
 }