/**
  * Adds the DocBlock XML definition to the given SimpleXMLElement.
  *
  * @param SimpleXMLElement $xml SimpleXMLElement to be appended to
  *
  * @return void
  */
 protected function addDocblockToSimpleXmlElement(SimpleXMLElement $xml)
 {
     $package = '';
     $subpackage = '';
     if ($this->getDocBlock()) {
         if (!isset($xml->docblock)) {
             $xml->addChild('docblock');
         }
         $xml->docblock->description = $this->getDocBlock()->getShortDescription();
         $xml->docblock->{'long-description'} = $this->getDocBlock()->getLongDescription()->getFormattedContents();
         /** @var DocBlox_Reflection_Docblock_Tag $tag */
         foreach ($this->getDocBlock()->getTags() as $tag) {
             $tag_object = $xml->docblock->addChild('tag');
             $this->dispatch('reflection.docblock.tag.pre-export', array(self::$event_dispatcher, $this, $tag_object, $tag));
             DocBlox_Parser_DocBlock_Tag_Definition::create($this->getNamespace(), $this->namespace_aliases, $tag_object, $tag);
             // custom attached member variable, see line 51
             if (isset($this->getDocBlock()->line_number)) {
                 $tag_object['line'] = $this->getDocBlock()->line_number;
             }
             if ($tag->getName() == 'package') {
                 $package = $tag->getDescription();
             }
             if ($tag->getName() == 'subpackage') {
                 $subpackage = $tag->getDescription();
             }
         }
     }
     // create a new 'meta-package' shaped like a namespace
     $xml['package'] = str_replace(array('.', '_'), '\\', $package . ($subpackage ? '\\' . $subpackage : ''));
     if ((string) $xml['package'] == '') {
         $xml['package'] = $this->getDefaultPackageName();
     }
 }
Exemplo n.º 2
0
 /**
  * Adds the DocBlock XML definition to the given SimpleXMLElement.
  *
  * @param SimpleXMLElement $xml SimpleXMLElement to be appended to
  *
  * @return void
  */
 protected function addDocblockToSimpleXmlElement(SimpleXMLElement $xml)
 {
     if (!$this->getDocBlock()) {
         return;
     }
     if (!isset($xml->docblock)) {
         $xml->addChild('docblock');
     }
     $xml->docblock->description = $this->getDocBlock()->getShortDescription();
     $xml->docblock->{'long-description'} = $this->getDocBlock()->getLongDescription()->getFormattedContents();
     /** @var DocBlox_Reflection_Docblock_Tag $tag */
     foreach ($this->getDocBlock()->getTags() as $tag) {
         $tag_object = $xml->docblock->addChild('tag');
         DocBlox_Parser_DocBlock_Tag_Definition::create($this->getNamespace(), $this->namespace_aliases, $tag_object, $tag);
         // custom attached member variable, see line 51
         if (isset($this->getDocBlock()->line_number)) {
             $tag_object['line'] = $this->getDocBlock()->line_number;
         }
     }
 }