public static function fromReflection(ReflectionProperty $reflectionProperty)
    {
        $pg = new static($reflectionProperty->getName());
        if ($reflectionProperty->getReflectionDocComment()->isEmpty() !== true) {
            $pg->setDocumentation(DocCommentGenerator::fromReflection($reflectionProperty->getReflectionDocComment()));
        }

        if ($reflectionProperty->isDefault() === true) {
            $defaultValue = $reflectionProperty->getDeclaringClass()->getDefaultProperties();
            $pg->setDefaultValue($defaultValue[$reflectionProperty->getName()]);
        }

        if ($reflectionProperty->isStatic() === true) {
            $pg->setStatic(true);
        }

        if ($reflectionProperty->isPrivate() === true) {
            $pg->setVisibility(Modifiers::VISIBILITY_PRIVATE);
        } elseif ($reflectionProperty->isProtected() === true) {
            $pg->setVisibility(Modifiers::VISIBILITY_PROTECTED);
        } else {
            $pg->setVisibility(Modifiers::VISIBILITY_PUBLIC);
        }

        return $pg;
    }
public static function fromReflection(ReflectionProperty $reflectionProperty)
    {
        $pg = new static($reflectionProperty->getName());
        if ($reflectionProperty->getReflectionDocComment()->isEmpty() !== true) {
            $pg->setDocumentation(DocCommentGenerator::fromReflection($reflectionProperty->getReflectionDocComment()));
        }

        if ($reflectionProperty->isDefault() === true) {
            $defaultValue = $reflectionProperty->getDeclaringClass()->getDefaultProperties();
            $pg->setDefaultValue($defaultValue[$reflectionProperty->getName()]);
        }

        if ($reflectionProperty->isStatic() === true) {
            $pg->setStatic(true);
        }

        if ($reflectionProperty->isPrivate() === true) {
            $pg->setVisibility(Modifiers::VISIBILITY_PRIVATE);
        } elseif ($reflectionProperty->isProtected() === true) {
            $pg->setVisibility(Modifiers::VISIBILITY_PROTECTED);
        } else {
            $pg->setVisibility(Modifiers::VISIBILITY_PUBLIC);
        }

        return $pg;
    }
public static function fromReflection ( ReflectionProperty $ reflectionProperty ) { $ pg = new static ( $ reflectionProperty -> getName ( ) ) ; if ( $ reflectionProperty -> getReflectionDocComment ( ) -> isEmpty ( ) !== true ) { $ pg -> setDocumentation ( DocCommentGenerator :: fromReflection ( $ reflectionProperty -> getReflectionDocComment ( ) ) ) ; } if ( $ reflectionProperty -> isDefault ( ) === true ) { $ defaultValue = $ reflectionProperty -> getDeclaringClass ( ) -> getDefaultProperties ( ) ; $ pg -> setDefaultValue ( $ defaultValue [ $ reflectionProperty -> getName ( ) ] ) ; } if ( $ reflectionProperty -> isStatic ( ) === true ) { $ pg -> setStatic ( true ) ; } if ( $ reflectionProperty -> isPrivate ( ) === true ) { $ pg -> setVisibility ( Modifiers :: VISIBILITY_PRIVATE ) ; } elseif ( $ reflectionProperty -> isProtected ( ) === true ) { $ pg -> setVisibility ( Modifiers :: VISIBILITY_PROTECTED ) ; } else { $ pg -> setVisibility ( Modifiers :: VISIBILITY_PUBLIC ) ; } return $ pg ; }
Create a new property generator from reflection.

@param \Wingu\OctopusCore\Reflection\ReflectionProperty $reflectionProperty The reflection of a class property.
@return \Wingu\OctopusCore\CodeGenerator\PHP\OOP\PropertyGenerator
Create a new property generator from reflection .