/var/www/vhosts/ihelp.ro/_OLD/vendor/robmorgan/phinx/src/Phinx/Db/Plan/Solver
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/robmorgan/phinx/src/Phinx/Db/Plan/Solver/ActionSplitter.php (3764B)
conflictClass = $conflictClass;
$this->conflictClassDual = $conflictClassDual;
$this->conflictFilter = $conflictFilter;
}
/**
* Returs a sequence of AlterTable instructions that are non conflicting
* based on the constructor parameters.
*
* @param \Phinx\Db\Plan\AlterTable $alter The collection of actions to inspect
*
* @return \Phinx\Db\Plan\AlterTable[] A list of AlterTable that can be executed without
* this type of conflict
*/
public function __invoke(AlterTable $alter)
{
$actions = collection($alter->getActions());
$conflictActions = $actions
->filter(function ($action) {
return $action instanceof $this->conflictClass;
})
->toList();
$originalAlter = new AlterTable($alter->getTable());
$newAlter = new AlterTable($alter->getTable());
$actions
->map(function ($action) use ($conflictActions) {
if (!$action instanceof $this->conflictClassDual) {
return [$action, null];
}
$found = false;
$matches = $this->conflictFilter;
foreach ($conflictActions as $ca) {
if ($matches($ca, $action)) {
$found = true;
break;
}
}
if ($found) {
return [null, $action];
}
return [$action, null];
})
->each(function ($pair) use ($originalAlter, $newAlter) {
list($original, $new) = $pair;
if ($original) {
$originalAlter->addAction($original);
}
if ($new) {
$newAlter->addAction($new);
}
});
return [$originalAlter, $newAlter];
}
}