isProtected() public method

public isProtected ( )
 /**
  * @param PropertyNode $node
  * @param ReflectionClass $declaringClass
  * @return ReflectionProperty
  */
 public static function createFromNode(PropertyNode $node, ReflectionClass $declaringClass)
 {
     $prop = new self();
     $prop->name = $node->props[0]->name;
     $prop->declaringClass = $declaringClass;
     if ($node->isPrivate()) {
         $prop->visibility = self::IS_PRIVATE;
     } elseif ($node->isProtected()) {
         $prop->visibility = self::IS_PROTECTED;
     } else {
         $prop->visibility = self::IS_PUBLIC;
     }
     $prop->isStatic = $node->isStatic();
     $prop->docBlockTypes = (new FindPropertyType())->__invoke($node, $prop);
     return $prop;
 }
 /**
  * Is the property protected?
  *
  * @return bool
  */
 public function isProtected()
 {
     return $this->node->isProtected();
 }
 private function processProperty(\PhpParser\Node\Stmt\Property $node) {
     $property = $node->props[0];
     $member = $this->unit->addMember($property->name);
     $this->setVariableType($member, $property->type);
     $this->setVariableDefaultValue($member, $property->default);
     $visibility = 'public';
     if ($node->isPrivate()) {
         $visibility = 'private';
     } elseif ($node->isProtected()) {
         $visibility = 'protected';
     }
     $member->setVisibility($visibility);
     $docComment = $node->getDocComment();
     if ($docComment !== NULL) {
         $block = $this->dockblocParser->parse($docComment, $this->aliasMap);
         $member->setDocBlock($block);
     }
     $member->setLine($node->getLine());
 }
 /**
  * {@inheritDoc}
  */
 public function isProtected()
 {
     return $this->propertyTypeNode->isProtected();
 }
Esempio n. 5
0
 /**
  * @param Property $node
  *
  * @return RefProperty
  */
 private function createProperty(Property $node)
 {
     $ref = new RefProperty();
     $ref->class = $this->class;
     $ref->name = $node->props[0]->name;
     $ref->default = $this->getValue($node->props[0]->default);
     if ($node->isPrivate()) {
         $ref->visibility = Visibility::IS_PRIVATE;
     } elseif ($node->isProtected()) {
         $ref->visibility = Visibility::IS_PROTECTED;
     } elseif ($node->isPublic()) {
         $ref->visibility = Visibility::IS_PUBLIC;
     }
     $ref->isStatic = $node->isStatic();
     $ref->line = $node->getLine();
     $ref->docComment = $this->createDocComment($node);
     return $ref;
 }
 /**
  * @param Node\Stmt\Property $node
  */
 protected function parseClassPropertyNode(Node\Stmt\Property $node)
 {
     foreach ($node->props as $property) {
         $this->structuralElements[$this->currentStructuralElement->namespacedName->toString()]['properties'][] = ['name' => $property->name, 'startLine' => $node->getLine(), 'isPublic' => $node->isPublic(), 'isPrivate' => $node->isPrivate(), 'isStatic' => $node->isStatic(), 'isProtected' => $node->isProtected(), 'docComment' => $node->getDocComment() ? $node->getDocComment()->getText() : null];
     }
 }
 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);
     }
 }