Composer/Migrations.php
private static function checkAndMoveFile($sourceMigrationFile, $appMigrationDir, IOInterface $io)
    {
        //get the file name
        $explodedPath = explode('/', $sourceMigrationFile);
        $filename = array_pop($explodedPath);
        
        if (file_exists($appMigrationDir.'/'.$filename)) {
            if (md5_file($appMigrationDir.'/'.$filename) === md5_file($sourceMigrationFile)) {
                if ($io->isVeryVerbose()) {
                    $io->write("<info>found that $sourceMigrationFile is equal"
                          . " to $appMigrationDir/$filename</info>");
                }
                $doTheMove = false;
            } else {
                $doTheMove = $io->askConfirmation("<question>The file \n"
                      . " \t$sourceMigrationFile\n has the same name than the previous "
                      . "migrated file located at \n\t$appMigrationDir/$filename\n "
                      . "but the content is not equal.\n Overwrite the file ?[y,N]", false);
            }
        } else {
            $doTheMove = true;
        }
        
        //move the file
        if ($doTheMove) {
            $fs = new Filesystem();
            $fs->copy($sourceMigrationFile, $appMigrationDir.'/'.$filename);
            $io->write("<info>Importing '$filename' migration file</info>");
            return true;
        }
        
        return false;
    }
private static function checkAndMoveFile($sourceMigrationFile, $appMigrationDir, IOInterface $io)
    {
        //get the file name
        $explodedPath = explode('/', $sourceMigrationFile);
        $filename = array_pop($explodedPath);
        
        if (file_exists($appMigrationDir.'/'.$filename)) {
            if (md5_file($appMigrationDir.'/'.$filename) === md5_file($sourceMigrationFile)) {
                if ($io->isVeryVerbose()) {
                    $io->write("<info>found that $sourceMigrationFile is equal"
                          . " to $appMigrationDir/$filename</info>");
                }
                $doTheMove = false;
            } else {
                $doTheMove = $io->askConfirmation("<question>The file \n"
                      . " \t$sourceMigrationFile\n has the same name than the previous "
                      . "migrated file located at \n\t$appMigrationDir/$filename\n "
                      . "but the content is not equal.\n Overwrite the file ?[y,N]", false);
            }
        } else {
            $doTheMove = true;
        }
        
        //move the file
        if ($doTheMove) {
            $fs = new Filesystem();
            $fs->copy($sourceMigrationFile, $appMigrationDir.'/'.$filename);
            $io->write("<info>Importing '$filename' migration file</info>");
            return true;
        }
        
        return false;
    }
private static function checkAndMoveFile ( $ sourceMigrationFile , $ appMigrationDir , IOInterface $ io ) { //get the file name $ explodedPath = explode ( '/' , $ sourceMigrationFile ) ; $ filename = array_pop ( $ explodedPath ) ; if ( file_exists ( $ appMigrationDir . '/' . $ filename ) ) { if ( md5_file ( $ appMigrationDir . '/' . $ filename ) === md5_file ( $ sourceMigrationFile ) ) { if ( $ io -> isVeryVerbose ( ) ) { $ io -> write ( "<info>found that $sourceMigrationFile is equal" . " to $appMigrationDir/$filename</info>" ) ; } $ doTheMove = false ; } else { $ doTheMove = $ io -> askConfirmation ( "<question>The file \n" . " \t$sourceMigrationFile\n has the same name than the previous " . "migrated file located at \n\t$appMigrationDir/$filename\n " . "but the content is not equal.\n Overwrite the file ?[y,N]" , false ) ; } } else { $ doTheMove = true ; } //move the file if ( $ doTheMove ) { $ fs = new Filesystem ( ) ; $ fs -> copy ( $ sourceMigrationFile , $ appMigrationDir . '/' . $ filename ) ; $ io -> write ( "<info>Importing '$filename' migration file</info>" ) ; return true ; } return false ; }
check if the file exists in dest dir, and if the file is equal. If not,
move the file do destination dir.

@param string $sourceMigrationFile
@param string $appMigrationDir
@param IOInterface $io
@return boolean
check if the file exists in dest dir and if the file is equal . If not move the file do destination dir .