/** * Return the type properties * * @return array */ public function getProperties() { if ($this->_properties === null) { $this->_properties = array(); $this->_currentProperties = array(); if (!$this->isEnum() && !$this->isArray()) { $reflectClass = new ReflectionClass($this->_type); $classesHierarchy = array(); $classesHierarchy[] = $reflectClass; $parentClass = $reflectClass; // lets get the class hierarchy so we could order the properties in the right order while ($parentClass = $parentClass->getParentClass()) { $classesHierarchy[] = $parentClass; } // reverse the hierarchy, top class properties should be first $classesHierarchy = array_reverse($classesHierarchy); foreach ($classesHierarchy as $currentReflectClass) { $properties = $currentReflectClass->getProperties(ReflectionProperty::IS_PUBLIC); foreach ($properties as $property) { if ($property->getDeclaringClass() == $currentReflectClass) { $name = $property->name; if (in_array($name, self::$properyReservedWords)) { throw new Exception("Property name [{$name}] is a reserved word in type [{$currentReflectClass}]"); } $docComment = $property->getDocComment(); $parsedDocComment = new KalturaDocCommentParser($docComment); if ($parsedDocComment->varType) { $prop = new KalturaPropertyInfo($parsedDocComment->varType, $name); $prop->setReadOnly($parsedDocComment->readOnly); $prop->setInsertOnly($parsedDocComment->insertOnly); $prop->setWriteOnly($parsedDocComment->writeOnly); $prop->setDynamicType($parsedDocComment->dynamicType); $prop->setServerOnly($parsedDocComment->serverOnly); $prop->setDeprecated($parsedDocComment->deprecated); $prop->setDeprecationMessage($parsedDocComment->deprecationMessage); $this->_properties[$name] = $prop; if ($property->getDeclaringClass() == $reflectClass) { $this->_currentProperties[] = $prop; } } if ($parsedDocComment->description) { $prop->setDescription($parsedDocComment->description); } if ($parsedDocComment->filter) { $prop->setFilters($parsedDocComment->filter); } if ($parsedDocComment->permissions) { $prop->setPermissions($parsedDocComment->permissions); } } } } $reflectClass = null; } } return $this->_properties; }