Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * 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;
 }