/** * fromReflection() * * @param Zend_Reflection_Property $reflectionProperty * @return Zend_CodeGenerator_Php_Property */ public static function fromReflection(Zend_Reflection_Property $reflectionProperty) { $property = new self(); $property->setName($reflectionProperty->getName()); $allDefaultProperties = $reflectionProperty->getDeclaringClass()->getDefaultProperties(); $property->setDefaultValue($allDefaultProperties[$reflectionProperty->getName()]); if ($reflectionProperty->getDocComment() != '') { $property->setDocblock(Zend_CodeGenerator_Php_Docblock::fromReflection($reflectionProperty->getDocComment())); } if ($reflectionProperty->isStatic()) { $property->setStatic(true); } if ($reflectionProperty->isPrivate()) { $property->setVisibility(self::VISIBILITY_PRIVATE); } elseif ($reflectionProperty->isProtected()) { $property->setVisibility(self::VISIBILITY_PROTECTED); } else { $property->setVisibility(self::VISIBILITY_PUBLIC); } $property->setSourceDirty(false); return $property; }
public function testDeclaringClassReturn() { $property = new Zend_Reflection_Property('Zend_Reflection_TestSampleClass2', '_prop1'); $this->assertEquals(get_class($property->getDeclaringClass()), 'Zend_Reflection_Class'); }