public static function create($name) { $reflectClass = new ReflectionClass($name); $result = new ckXsdComplexType($name, ckXsdNamespace::get('tns')); foreach ($reflectClass->getProperties() as $property) { $type = ckDocBlockParser::parseProperty($property->getDocComment()); if (!empty($type)) { $result->addElement(new ckXsdComplexTypeElement($property->getName(), ckXsdType::get($type['type']))); } } return $result; }
/** * Enter description here... * * @param string $key * * @return ckXsdType */ public static function get($key) { if (isset(self::$typeRegistry[$key])) { return self::$typeRegistry[$key]; } else { if (ckXsdSimpleType::isSimpleType($key)) { return self::set($key, ckXsdSimpleType::create($key)); } else { if (ckXsdArrayType::isArrayType($key)) { return self::set($key, ckXsdArrayType::create($key)); } else { if (class_exists($key, true)) { return self::set($key, ckXsdComplexType::create($key)); } else { return null; } } } } }
/** * Gets a xsd type with a given name from the registry or creates and registers a new one if none exists. * * @param string $typeName The name of the xsd type * * @return ckXsdType The xsd type object, or null if none exists or can be created */ public static function get($typeName) { if (isset(self::$typeRegistry[$typeName])) { return self::$typeRegistry[$typeName]; } else { if (ckXsdSimpleType::isSimpleType($typeName)) { return self::set($typeName, ckXsdSimpleType::create($typeName)); } else { if ($typeName == 'array') { return self::set($typeName, ckXsdArrayType::create('anyType' . ckXsdArrayType::ARRAY_SUFFIX)); } else { if (ckXsdArrayType::isArrayType($typeName)) { return self::set($typeName, ckXsdArrayType::create($typeName)); } else { if (class_exists($typeName, true)) { return self::set($typeName, ckXsdComplexType::create($typeName)); } else { return null; } } } } } }
/** * Protected constructor initializing the array type with a given name, a given namespace and a given element type. * * @param string $name The name of the array * @param ckXsdNamespace $namespace The namespace of the array type * @param ckXsdType $elementType The type of the elements of the array */ protected function __construct($name = null, ckXsdNamespace $namespace = null, ckXsdType $elementType = null) { parent::__construct($name, $namespace); $this->setElementType($elementType); }