Chris@0: name = $name; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Makes the property public. Chris@0: * Chris@0: * @return $this The builder instance (for fluid interface) Chris@0: */ Chris@0: public function makePublic() { Chris@0: $this->setModifier(Stmt\Class_::MODIFIER_PUBLIC); Chris@0: Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Makes the property protected. Chris@0: * Chris@0: * @return $this The builder instance (for fluid interface) Chris@0: */ Chris@0: public function makeProtected() { Chris@0: $this->setModifier(Stmt\Class_::MODIFIER_PROTECTED); Chris@0: Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Makes the property private. Chris@0: * Chris@0: * @return $this The builder instance (for fluid interface) Chris@0: */ Chris@0: public function makePrivate() { Chris@0: $this->setModifier(Stmt\Class_::MODIFIER_PRIVATE); Chris@0: Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Makes the property static. Chris@0: * Chris@0: * @return $this The builder instance (for fluid interface) Chris@0: */ Chris@0: public function makeStatic() { Chris@0: $this->setModifier(Stmt\Class_::MODIFIER_STATIC); Chris@0: Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets default value for the property. Chris@0: * Chris@0: * @param mixed $value Default value to use Chris@0: * Chris@0: * @return $this The builder instance (for fluid interface) Chris@0: */ Chris@0: public function setDefault($value) { Chris@0: $this->default = $this->normalizeValue($value); Chris@0: Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets doc comment for the property. Chris@0: * Chris@0: * @param PhpParser\Comment\Doc|string $docComment Doc comment to set Chris@0: * Chris@0: * @return $this The builder instance (for fluid interface) Chris@0: */ Chris@0: public function setDocComment($docComment) { Chris@0: $this->attributes = array( Chris@0: 'comments' => array($this->normalizeDocComment($docComment)) Chris@0: ); Chris@0: Chris@0: return $this; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the built class node. Chris@0: * Chris@0: * @return Stmt\Property The built property node Chris@0: */ Chris@0: public function getNode() { Chris@0: return new Stmt\Property( Chris@0: $this->flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC, Chris@0: array( Chris@0: new Stmt\PropertyProperty($this->name, $this->default) Chris@0: ), Chris@0: $this->attributes Chris@0: ); Chris@0: } Chris@0: }