/** * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedVariableAbstract::setVariableName * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedVariableAbstract::getVariableName */ public function testSetAndGetVariableName() { $this->assertEmpty($this->fixture->getVariableName()); $this->fixture->setVariableName(self::EXAMPLE_NAME); $result = $this->fixture->getVariableName(); $this->assertSame(self::EXAMPLE_NAME, $result); }
/** * @covers phpDocumentor\Descriptor\PropertyDescriptor::getDefault * @covers phpDocumentor\Descriptor\PropertyDescriptor::setDefault */ public function testSetAndGetDefault() { $this->assertSame(null, $this->fixture->getDefault()); $this->fixture->setDefault('a'); $this->assertSame('a', $this->fixture->getDefault()); }
/** * @return Collection */ public function getMagicProperties() { /** @var Collection $propertyTags */ $propertyTags = clone $this->getTags()->get('property', new Collection()); $propertyTags = $propertyTags->merge($this->getTags()->get('property-read', new Collection())); $propertyTags = $propertyTags->merge($this->getTags()->get('property-write', new Collection())); $properties = new Collection(); /** @var Tag\PropertyDescriptor $propertyTag */ foreach ($propertyTags as $propertyTag) { $property = new PropertyDescriptor(); $property->setName(ltrim($propertyTag->getVariableName(), '$')); $property->setDescription($propertyTag->getDescription()); $property->setTypes($propertyTag->getTypes()); $property->setParent($this); $properties->add($property); } if ($this->getParent() instanceof ClassDescriptor) { $properties = $properties->merge($this->getParent()->getMagicProperties()); } return $properties; }
/** * Returns whether this value is applicable for given conditions * * @param string $name * @param int $occurance * * @return bool */ public function isApplicable(string $name, int $occurance) : bool { return $this->property->matches($name, $occurance); }