/**
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::setPackage
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPackage
  */
 public function testSettingAndGettingPackage()
 {
     $package = new PackageDescriptor();
     $this->assertSame(null, $this->fixture->getPackage());
     $this->fixture->setPackage($package);
     $this->assertSame($package, $this->fixture->getPackage());
 }
 /**
  * Exports the given reflection object to the parent XML element.
  *
  * This method creates a new child element on the given parent XML element
  * and takes the properties of the Reflection argument and sets the
  * elements and attributes on the child.
  *
  * If a child DOMElement is provided then the properties and attributes are
  * set on this but the child element is not appended onto the parent. This
  * is the responsibility of the invoker. Essentially this means that the
  * $parent argument is ignored in this case.
  *
  * @param \DOMElement        $parent  The parent element to augment.
  * @param DescriptorAbstract $element The data source.
  *
  * @return \DOMElement
  */
 public function convert(\DOMElement $parent, DescriptorAbstract $element)
 {
     $child = new \DOMElement('docblock');
     $parent->appendChild($child);
     $child->setAttribute('line', $element->getLine());
     $package = str_replace('&', '&', ltrim($element->getPackage(), '\\'));
     $parent->setAttribute('package', $package ?: 'global');
     $this->addSummary($child, $element);
     $this->addDescription($child, $element);
     $this->addTags($child, $element);
     $this->addInheritedFromTag($child, $element);
     return $child;
 }
 /**
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::setPackage
  * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPackage
  */
 public function testSettingAndGettingPackage()
 {
     $this->assertSame('', $this->fixture->getPackage());
     $this->fixture->setPackage('Package');
     $this->assertSame('Package', $this->fixture->getPackage());
 }
Beispiel #4
0
 /**
  * Exports the given reflection object to the parent XML element.
  *
  * This method creates a new child element on the given parent XML element
  * and takes the properties of the Reflection argument and sets the
  * elements and attributes on the child.
  *
  * If a child DOMElement is provided then the properties and attributes are
  * set on this but the child element is not appended onto the parent. This
  * is the responsibility of the invoker. Essentially this means that the
  * $parent argument is ignored in this case.
  *
  * @param \DOMElement        $parent  The parent element to augment.
  * @param DescriptorAbstract $element The data source.
  *
  * @return void
  */
 public function buildDocBlock(\DOMElement $parent, DescriptorAbstract $element)
 {
     $child = new \DOMElement('docblock');
     $parent->appendChild($child);
     $child->setAttribute('line', $element->getLine());
     $parent->setAttribute('package', ltrim($element->getPackage(), '\\'));
     $this->addDescription($child, $element);
     $this->addLongDescription($child, $element);
     $this->addTags($child, $element);
 }