public function addProperty(PropertyNode $node) { foreach ($node->props as $prop) { $property = new ReflectionProperty($prop->name); $property->setStartLine((int) $node->getAttribute('startLine')); $property->setEndLine((int) $node->getAttribute('endLine')); $property->setDocComment((string) $node->getDocComment()); $property->setStatic((bool) $node->isStatic()); if (!is_null($prop->default)) { $value = $this->resolveValue($prop->default); $property->setDefault(strtolower(gettype($value)), $value); } if ($node->isPrivate()) { $property->setVisibility(ReflectionProperty::IS_PRIVATE); } elseif ($node->isProtected()) { $property->setVisibility(ReflectionProperty::IS_PROTECTED); } else { $property->setVisibility(ReflectionProperty::IS_PUBLIC); } $this->context->getReflection()->addProperty($property); } }
/** * Add a property to the reflected class. * * @param ReflectionProperty $property */ public function addProperty(ReflectionProperty $property) { $this->properties[$property->getShortName()] = $property; $property->setDeclaringClassLike($this); $property->setFilename($this->getFileName()); return $this; }