示例#1
0
 public function testCamel()
 {
     $this->assertEquals('hereIAm', Strings::camel('Here I am'));
     $this->assertEquals('hereIAm', Strings::camel('Here-I am'));
     $this->assertEquals('hereIAm', Strings::camel('Here I am!'));
     $this->assertEquals('hereIAm', Strings::camel(',Here I am'));
     $this->assertEquals('meVoila', Strings::camel('Me voilà'));
 }
示例#2
0
文件: generate.php 项目: demental/m
 public function generate_migration($name, $format = 'php', $pluginName = '')
 {
     if (!empty($pluginName)) {
         $basepath = PluginRegistry::initPlugin($pluginName);
     } else {
         $basepath = APP_ROOT;
     }
     $file = $basepath . 'db/migrations/' . date('YmdHi') . '_' . Strings::snake($name) . '.' . $format;
     $classname = Strings::camel($name);
     $source = file_get_contents(dirname(__FILE__) . '/generate/migration/' . $format . '.tpl');
     $source = str_replace('[MIGRATION_NAME]', $classname, $source);
     file_put_contents($file, $source);
     $this->line($file . ' created');
 }
示例#3
0
文件: db.php 项目: demental/m
 protected static function _migrations_in_folder($folder, &$out)
 {
     foreach (FileUtils::getFiles($folder) as $file) {
         if (preg_match('`^(\\d+)_(.+)\\.(php|sql)$`', basename($file), $matches)) {
             $out[$matches[1]] = array('file' => $folder . $file, 'class' => 'Migration_' . Strings::camel($matches[2]), 'description' => str_replace('_', ' ', $matches[2]), 'type' => $matches[3]);
         }
     }
 }