/**
  * MEvolution constructor.
  * @param string $settingsFilePath
  * @param string $evolutionsFolderPath
  * @param int $to
  */
 public function __construct($settingsFilePath, $evolutionsFolderPath, $to)
 {
     $this->settingsFilePath = realpath($settingsFilePath);
     $this->evolutionsFolderPath = realpath($evolutionsFolderPath);
     $this->validatePaths();
     if ($to != null) {
         $this->to = (int) $to;
     }
     $this->settings = SettingsFile::parse($this->settingsFilePath);
     $this->driver = DriverFactory::get($this->settings);
     $this->filePathList = EvolutionFile::getList($this->evolutionsFolderPath);
 }
 /**
  * Creates the table of the evolutions into the database.<br>
  * Inserts the new evolutions in the table.
  */
 public function init()
 {
     echo 'Creating evolution table...' . PHP_EOL;
     $this->getDriver()->createEvolutionsTable();
     $lastEvolutionId = $this->getDriver()->getLastEvolutionId();
     echo 'Updating evolution table...' . PHP_EOL;
     foreach ($this->getFilePathList() as $filePath) {
         $evolution = EvolutionFile::getEvolution($filePath);
         if ($lastEvolutionId < $evolution->getId()) {
             $this->getDriver()->insertEvolution($evolution->getId(), $evolution->getUp(), $evolution->getDown());
             echo sprintf("\tInserted evolution %s%s.", $evolution->getId(), PHP_EOL);
         }
     }
     echo PHP_EOL . 'INIT completed without errors.' . PHP_EOL;
 }