示例#1
0
文件: dmLorem.php 项目: theolymp/diem
 protected static function getMarkdownLoremText()
 {
     if (null === self::$markdownLoremText) {
         self::$markdownLoremText = implode('', file(dmOs::join(sfConfig::get("dm_core_dir"), "data/lorem/markdown")));
     }
     return self::$markdownLoremText;
 }
示例#2
0
 protected function getStringValForColumn($column)
 {
     if (dmArray::get($column, 'email')) {
         return dmString::random(mt_rand(4, 30)) . '@localhost.com';
     }
     if ($this->table->isLinkColumn($column['name'])) {
         return $this->getRandomLink();
     }
     if ($column['length'] < 40) {
         $nbCarac = mt_rand(1, $column['length']);
     } else {
         $maxLen = $column['length'] > 80 ? $column['length'] / 2 : $column['length'];
         $nbCarac = mt_rand(min(4, $column['length']), max(40, $maxLen));
     }
     $val = trim(dmLorem::getLittleLorem($nbCarac));
     if (dmArray::get($column, 'unique')) {
         $val = substr(dmString::random(4) . ' ' . $val, 0, $column['length']);
     }
     if (dmArray::get($column, 'nospace')) {
         $val = str_replace(' ', '-', $val);
     }
     return $val;
 }