/**
  * Parse annotations from string
  *
  * @throws  lang.FormatException in case the annotations cannot be parsed
  */
 protected function parse()
 {
     if (is_array($this->_parsed)) {
         return;
     }
     // Short-cuircuit: We've already parsed it
     $this->_parsed = [];
     if ($this->annotations) {
         $parser = new ClassParser();
         foreach ($parser->parseAnnotations($this->annotations, $this->getClassName())[0] as $name => $value) {
             $this->_parsed[$name] = new AnnotationDoc($name, $value);
         }
     }
 }
Exemple #2
0
 /**
  * Gets field type
  *
  * @return  string
  */
 public function getTypeName()
 {
     $raw = $this->_reflect->getDocComment();
     if (false === $raw) {
         if ($details = \lang\XPClass::detailsForField($this->_reflect->getDeclaringClass()->getName(), $this->_reflect->getName())) {
             if (isset($details[DETAIL_ANNOTATIONS]['type'])) {
                 return $details[DETAIL_ANNOTATIONS]['type'];
             }
         }
     } else {
         if (preg_match('/@(var|type)\\s*([^\\r\\n]+)/', $raw, $matches)) {
             return ClassParser::typeIn($matches[2]);
         }
     }
     return 'var';
 }