示例#1
0
 function formatStatic($key)
 {
     if (!is_array($this->dictionary)) {
         /**没有静态区间标注*/
         return "";
     }
     $StaticKey = $this->getStaticKey();
     if (!array_key_exists($key, $StaticKey)) {
         throw new Exception("formatStatic StaticKey no found {$key} !");
     }
     $static = $StaticKey[$key];
     $static = parent::getFileContents($static);
     $result = "";
     foreach ($this->dictionary as $value => $note) {
         $name = $value;
         if ($this->note_type == self::NOTE_TYPE_AUTO && $key != Element::TYPE_KEY_STRING && !empty($note)) {
             $az = language_new_az($note);
             if (!empty($az) && preg_match("/^[a-zA-Z\\s]+\$/", $az)) {
                 $name = $az;
             }
         }
         $name = self::FORMAT_STATIC . strtoupper("_" . $this->name . "_{$name}");
         $data = str_replace(Element::FORMAT_NOTE, $note, $static);
         $data = str_replace(Element::FORMAT_CLASS, $name, $data);
         $data = str_replace(Element::FORMAT_DATA_KEY, strval($value), $data);
         $result .= $data;
     }
     return $result;
 }
示例#2
0
 /**
  * 获取注释
  * */
 public function getNoteFormat()
 {
     if (empty($this->note)) {
         //return "";
     }
     if ($this->note_type == Element::NOTE_TYPE_AUTO && preg_match("/^[a-zA-Z\\s]+\$/", $this->note)) {
         $az = language_new_az($this->note);
         if (!empty($az)) {
             $this->note = $az;
         }
     }
     return $this->note;
 }