コード例 #1
0
ファイル: LongDescription.php プロジェクト: rhysr/Docblox
 /**
  * Parses the string for inline tags and if the Markdown class is included; format the found text.
  *
  * @param string $content
  */
 public function __construct($content)
 {
     if (preg_match('/\\{\\@(.+?)\\}/', $content, $matches)) {
         array_shift($matches);
         foreach ($matches as $tag) {
             $this->tags[] = DocBlox_Reflection_DocBlock_Tag::createInstance('@' . $tag);
         }
     }
     $this->contents = trim($content);
 }
コード例 #2
0
ファイル: Definition.php プロジェクト: rhysr/Docblox
 /**
  * Adds type information to the structure.
  *
  * @todo Move this method to a better spot with namespace and alias access (together with namespace and alias stuff).
  *
  * @param string[] $types
  *
  * @return void
  */
 public function setTypes($types)
 {
     foreach ($types as $type) {
         if ($type == '') {
             continue;
         }
         $type = trim($this->expandType($type));
         // strip ampersands
         $name = str_replace('&', '', $type);
         $type_object = $this->xml->addChild('type', $name);
         // register whether this variable is by reference by checking the first and last character
         $type_object['by_reference'] = substr($type, 0, 1) === '&' || substr($type, -1) === '&' ? 'true' : 'false';
     }
     $this->xml['type'] = $this->expandType($this->tag->getType());
 }
コード例 #3
0
ファイル: DocBlock.php プロジェクト: hjr3/Docblox
 /**
  * Creates the tag objects.
  *
  * @param string $tags
  *
  * @return void
  */
 protected function parseTags($tags)
 {
     $result = array();
     foreach (explode("\n", trim($tags)) as $tag_line) {
         if (trim($tag_line) === '') {
             continue;
         }
         if (isset($tag_line[0]) && $tag_line[0] === '@') {
             $result[] = $tag_line;
         } else {
             if (count($result) == 0) {
                 throw new Exception('A tag block started with text instead of an actual tag, this makes the tag block invalid: ' . $tags);
             }
             $result[count($result) - 1] .= PHP_EOL . $tag_line;
         }
     }
     // create proper Tag objects
     foreach ($result as $key => $tag_line) {
         $result[$key] = DocBlox_Reflection_DocBlock_Tag::createInstance($tag_line);
     }
     $this->tags = $result;
 }
コード例 #4
0
ファイル: Param.php プロジェクト: rvanvelzen/phpDocumentor2
 /**
  * Implements DocBlox_Reflection_DocBlock_Tag_Interface
  *
  * @param SimpleXMLElement $xml Relative root of xml document
  */
 public function __toXml(SimpleXMLElement $xml)
 {
     parent::__toXml($xml);
     foreach ($this->getTypes() as $type) {
         if ($type == '') {
             continue;
         }
         $type = trim($this->docblock->expandType($type));
         // strip ampersands
         $name = str_replace('&', '', $type);
         $type_object = $xml->addChild('type', $name);
         // register whether this variable is by reference by checking the first and last character
         $type_object['by_reference'] = substr($type, 0, 1) === '&' || substr($type, -1) === '&' ? 'true' : 'false';
     }
     $xml['type'] = $this->docblock->expandType($this->getType());
     if (trim($this->getVariableName()) == '') {
         // TODO: get the name from the argument list
     }
     $xml['variable'] = $this->getVariableName();
 }
コード例 #5
0
ファイル: Link.php プロジェクト: rvanvelzen/phpDocumentor2
 /**
  * Implements DocBlox_Reflection_DocBlock_Tag_Interface
  *
  * @param SimpleXMLElement $xml Relative root of xml document
  */
 public function __toXml(SimpleXMLElement $xml)
 {
     parent::__toXml($xml);
     $xml['link'] = $this->getLink();
 }