public function getMigrationDirectory()
{
$dir = $this->configuration->getMigrationsDirectory();
$dir = $dir ? $dir : getcwd();
$dir = rtrim($dir, '/');
if (!file_exists($dir)) {
throw new \InvalidArgumentException(sprintf('Migrations directory "%s" does not exist.', $dir));
}
if ($this->configuration->areMigrationsOrganizedByYear()) {
$dir .= $this->appendDir(date('Y'));
}
if ($this->configuration->areMigrationsOrganizedByYearAndMonth()) {
$dir .= $this->appendDir(date('m'));
}
$this->createDirIfNotExists($dir);
return $dir;
}