function formatClass() { $TypeKey = $this->getTypeKey(); $note = parent::getNoteFormat(); if (!is_array($this->value)) { throw new Exception("formatClass is_array error!"); } $format = $TypeKey[Element::TYPE_KEY_CLASS]; $format = parent::getFileContents($format); if (empty($format)) { throw new Exception("formatClass TYPE_KEY_CLASS null!"); } $format = str_replace(Element::FORMAT_CLASS, $this->divname, $format); $data = ""; foreach ($this->value as $key => $value) { if ($value != null) { $element = $this->getElement(); $element->initElement($key, $value, $this->getClassElement($key)); $data = $data . $element->format(); } } $format = str_replace(Element::FORMAT_DATA, $data, $format); $format = str_replace(DataElement::FORMAT_JSON_DATA, $this->parse(), $format); $format = str_replace(Element::FORMAT_NOTE, $note, $format); $format = str_replace(Element::FORMAT_VERSION, $this->version, $format); $result = JAVA_NATIVE_HEAD . $format; $fileurl = $this->getFileUrl($result, $this->divname . ".java"); return $result; }
function formatClass() { $TypeKey = $this->getTypeKey(); $note = parent::getNoteFormat(); if (!is_array($this->value)) { throw new Exception("formatClass is_array error!"); } $format = $TypeKey[Element::TYPE_KEY_CLASS]; $format = parent::getFileContents($format); if (empty($format)) { throw new Exception("formatClass TYPE_KEY_CLASS null!"); } $format = str_replace(Element::FORMAT_CLASS, $this->divname, $format); $data = ""; foreach ($this->value as $key => $value) { if ($value != null) { $element = $this->getElement(); $element->initElement($key, $value, $this->getClassElement($key)); $data = $data . $element->format(); /**累计增加所有对象*/ $this->addMClass($element); /**遍历所有数组对象方法*/ $this->addMArrayClass($element); $this->addClassNested($element); $this->addStaticParams($element); $this->addImportParams($element); $this->addClassParams($element); } } $format = str_replace(Element::FORMAT_DATA, $data, $format); $format = str_replace(Element::FORMAT_NOTE, $note, $format); $format = str_replace(Element::FORMAT_VERSION, $this->version, $format); $format = str_replace(self::FORMAT_STATIC, $this->getStaticParams(), $format); $format = str_replace(self::FORMAT_IMPORT, $this->getImportParams(), $format); $format = str_replace(self::FORMAT_CLASS, $this->getClassParams(), $format); $result = $format . $this->getClassNestedData(); /**解析.m文件*/ $this->parseClass(); $fileurl = $this->getFileUrl($result, $this->divname . ".h"); $m_result = $this->getMClassData(); $fileurl = $this->getFileUrl($m_result, $this->divname . ".m"); $node = "<br /><br />--------------------------------【.m解释文件】--------------------------------"; $result .= $node . $m_result; return $result; }