Esempio n. 1
0
 /**
  * @return string
  */
 public function getArgument()
 {
     if (!$this->text) {
         return null;
     }
     $text = StringUtils::split($this->text, '~\\s~');
     return reset($text);
 }
 /**
  * @param string $source
  *
  * @return IAnnotationReflection
  */
 public static function build($source)
 {
     $annotationReflection = new self($source);
     foreach (StringUtils::split($source, '~\\n~s') as $line) {
         if (($annotation = StringUtils::match($line, '~@(?<annotation>[a-zA-Z0-9_-]+)(\\s+(?<text>.*))?~')) === null) {
             continue;
         }
         $annotationReflection->addAnnotation(new Annotation($annotation['annotation'], isset($annotation['text']) ? $annotation['text'] : null));
     }
     return $annotationReflection;
 }