コード例 #1
0
 /**
  * @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;
 }
コード例 #2
0
 /**
  * 
  *
  * @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();
     }
 }
コード例 #3
0
 /**
  * 
  */
 public function toString()
 {
     $string = new MMutableString();
     foreach ($this->allKeys()->toArray() as $key) {
         $string->appendFormat("%s:%s", urlencode((string) $key), urlencode((string) $this->objectForKey($key)));
         if (!$this->allKeys()->isLastObject($key)) {
             $string->appendString(S("|"));
         }
     }
     return $string;
 }