/** * * @param string $finder * @param Schema $schema * @param DOMElement $node * @param string $typeName * @throws TypeException * @return ElementItem|Group|AttributeItem|AttribiuteGroup|Type */ private function findSomething($finder, Schema $schema, DOMElement $node, $typeName) { list($name, $namespace) = self::splitParts($node, $typeName); $namespace = $namespace ?: $schema->getTargetNamespace(); try { return $schema->{$finder}($name, $namespace); } catch (TypeNotFoundException $e) { throw new TypeException(sprintf("Can't find %s named {%s}#%s, at line %d in %s ", strtolower(substr($finder, 4)), $namespace, $name, $node->getLineNo(), $node->ownerDocument->documentURI), 0, $e); } }
public function addSchema(Schema $schema, $namespace = null) { if ($namespace !== null && $schema->getTargetNamespace() !== $namespace) { throw new SchemaException(sprintf("The target namespace ('%s') for schema, does not match the declared namespace '%s'", $schema->getTargetNamespace(), $namespace)); } if ($namespace !== null) { $this->schemas[$namespace] = $schema; } else { $this->schemas[] = $schema; } }
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"] = "GoetasWebservices\\Xsd\\XsdToPhp\\Jms\\SimpleListOf<" . $valueProp . ">"; } else { $property["type"] = "GoetasWebservices\\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; }