Esempio n. 1
0
 /**
  * Internal helper, does the parsing of the comment.
  * Returns an array of all annotations.
  *
  * @param string $strDoc
  * @return array ["annotation_name" => array("values" => values, "params" => params)]
  */
 private function searchAllAnnotationsInDoc($strDoc)
 {
     $strDoc = uniStrReplace(array("\r\n", "\r"), "\n", $strDoc);
     //replace needed as regex on windows or mac won't work properly
     $arrReturn = array();
     $strCacheKey = md5($strDoc);
     if (isset($this->arrCurrentCache[self::$STR_DOC_COMMENT_PROPERTIES_CACHE][$strCacheKey])) {
         return $this->arrCurrentCache[self::$STR_DOC_COMMENT_PROPERTIES_CACHE][$strCacheKey];
     }
     $arrMatches = array();
     if (preg_match_all("/(@[a-zA-Z0-9]+)(\\s+.*)?(\\s+\\(.*\\))?\$/Um", $strDoc, $arrMatches, PREG_SET_ORDER) !== false) {
         foreach ($arrMatches as $arrOneMatch) {
             $strName = $arrOneMatch[1];
             $strValue = isset($arrOneMatch[2]) ? $arrOneMatch[2] : "";
             $strParams = isset($arrOneMatch[3]) ? $arrOneMatch[3] : "";
             if (!isset($arrReturn[$strName])) {
                 $arrReturn[$strName] = array("values" => array(), "params" => array());
             }
             $arrReturn[$strName]["values"][] = trim($strValue);
             $arrReturn[$strName]["params"][] = $this->params2Array(trim($strParams));
         }
     }
     $this->arrCurrentCache[self::$STR_DOC_COMMENT_PROPERTIES_CACHE][$strCacheKey] = $arrReturn;
     self::$bitCacheSaveRequired = true;
     return $arrReturn;
 }