protected function getNewMigrations()
{
$applied = [];
foreach ($this->getMigrationHistory(null) as $class => $time) {
$applied[trim($class, '\\')] = true;
}
$migrationPaths = [];
if (!empty($this->migrationPath)) {
$migrationPaths[''] = $this->migrationPath;
}
foreach ($this->migrationNamespaces as $namespace) {
$migrationPaths[$namespace] = $this->getNamespacePath($namespace);
}
$migrations = [];
foreach ($migrationPaths as $namespace => $migrationPath) {
if (!file_exists($migrationPath)) {
continue;
}
$handle = opendir($migrationPath);
while (($file = readdir($handle)) !== false) {
if ($file === '.' || $file === '..') {
continue;
}
$path = $migrationPath . DIRECTORY_SEPARATOR . $file;
if (preg_match('/^(m(\\d{6}_?\\d{6})\\D.*?)\\.php$/is', $file, $matches) && is_file($path)) {
$class = $matches[1];
if (!empty($namespace)) {
$class = $namespace . '\\' . $class;
}
$time = str_replace('_', '', $matches[2]);
if (!isset($applied[$class])) {
$migrations[$time . '\\' . $class] = $class;
}
}
}
closedir($handle);
}
ksort($migrations);
return array_values($migrations);
}