src/Migrator.php
public function createMigration($name, $templateName, array $replace = [], $subDir = '')
    {
        $targetDir = $this->dir;
        $subDir = trim(str_replace('\\', '/', $subDir), '/');
        if ($subDir) {
            $targetDir .= '/' . $subDir;
        }

        $this->files->createDirIfItDoesNotExist($targetDir);

        $fileName = $this->constructFileName($name);
        $className = $this->getMigrationClassNameByFileName($fileName);
        $templateName = $this->templates->selectTemplate($templateName);

        $template = $this->files->getContent($this->templates->getTemplatePath($templateName));
        $template = $this->replacePlaceholdersInTemplate($template, array_merge($replace, ['className' => $className]));

        $this->files->putContent($targetDir.'/'.$fileName.'.php', $template);

        return $fileName;
    }
public function createMigration($name, $templateName, array $replace = [], $subDir = '')
    {
        $targetDir = $this->dir;
        $subDir = trim(str_replace('\\', '/', $subDir), '/');
        if ($subDir) {
            $targetDir .= '/' . $subDir;
        }

        $this->files->createDirIfItDoesNotExist($targetDir);

        $fileName = $this->constructFileName($name);
        $className = $this->getMigrationClassNameByFileName($fileName);
        $templateName = $this->templates->selectTemplate($templateName);

        $template = $this->files->getContent($this->templates->getTemplatePath($templateName));
        $template = $this->replacePlaceholdersInTemplate($template, array_merge($replace, ['className' => $className]));

        $this->files->putContent($targetDir.'/'.$fileName.'.php', $template);

        return $fileName;
    }
public function createMigration ( $ name , $ templateName , array $ replace = [ ] , $ subDir = '' ) { $ targetDir = $ this -> dir ; $ subDir = trim ( str_replace ( '\\' , '/' , $ subDir ) , '/' ) ; if ( $ subDir ) { $ targetDir .= '/' . $ subDir ; } $ this -> files -> createDirIfItDoesNotExist ( $ targetDir ) ; $ fileName = $ this -> constructFileName ( $ name ) ; $ className = $ this -> getMigrationClassNameByFileName ( $ fileName ) ; $ templateName = $ this -> templates -> selectTemplate ( $ templateName ) ; $ template = $ this -> files -> getContent ( $ this -> templates -> getTemplatePath ( $ templateName ) ) ; $ template = $ this -> replacePlaceholdersInTemplate ( $ template , array_merge ( $ replace , [ 'className' => $ className ] ) ) ; $ this -> files -> putContent ( $ targetDir . '/' . $ fileName . '.php' , $ template ) ; return $ fileName ; }
Create migration file.

@param string $name         - migration name
@param string $templateName
@param array  $replace      - array of placeholders that should be replaced with a given values.
@param string  $subDir

@return string
Create migration file .