/** * */ public function toString() { $doc = new MMutableString(); $doc->appendLine(S("<?xml version=\"1.0\"?>")); $doc->appendLine(parent::toString()); return $doc; }
/** * */ public function toString() { $str = new MMutableString(); foreach ($this->subviews()->toArray() as $view) { if (!$this->subviews()->isLastObject($view)) { $str->appendLine($view->toString()); } else { $str->appendString($view->toString()); } } return $str; }
/** * * * @return MString */ public function toString() { if ($this->element()) { $markup = new MMutableString(); $indentString = MString::stringWithRepeatingString(S(" "), $this->indentLevel()); $properties = new MMutableArray(); foreach ($this->properties()->allKeys()->toArray() as $name) { $value = $this->properties()->objectForKey($name); $properties->addObject(Sf("%s=\"%s\"", $name, $value)); } if ($properties->count() > 0) { $markup->appendFormat("%s<%s %s", $indentString, $this->element(), $properties->componentsJoinedByString(S(" "))); } else { $markup->appendFormat("%s<%s", $indentString, $this->element()); } if ($this->text()) { $markup->appendFormat(">%s</%s>", $this->text()->stringByEncodingHTMLEntities(), $this->element()); } else { if ($this->subviews()->count() > 0) { $markup->appendLine(S(">")); $markup->appendLine(parent::toString()); $markup->appendString(Sf("%s</%s>", $indentString, $this->element())); } else { $markup->appendString(S("/>")); } } if ($this->shouldAppendEmptyLine()) { $markup->appendLine(); } return $markup; } else { return parent::toString(); } }
/** * @internal * * @return MString */ protected function createTableQuery(MString $tableName, MArray $fields, MString $primaryKey = null) { $tableQuery = new MMutableString(); $tableQuery->appendLine(Sf("CREATE TABLE `%s` (", $tableName)); $tableQuery->appendString($fields->componentsJoinedByString(S(",\n"))); if (!empty($primaryKey)) { $tableQuery->appendFormat(",\nPRIMARY KEY (`%s`)", $primaryKey); } $tableQuery->appendLine(S("\n);")); $tableQuery->appendLine(S("")); return $tableQuery; }