// Build the list of ScaffoldFileInfo objects by project.
foreach ($file_mappings as $package_name =>
$package_file_mappings) { foreach ($package_file_mappings as $destination_rel_path =>
$op) { $destination = ScaffoldFilePath::
destinationPath($package_name,
$destination_rel_path,
$location_replacements);
// If there was already a scaffolding operation happening at this path,
// allow the new operation to decide how to handle the override.
// Usually, the new operation will replace whatever was there before.
if (isset($scaffoldFiles[$destination_rel_path])) { $previous_scaffold_file =
$scaffoldFiles[$destination_rel_path];
$op =
$op->
scaffoldOverExistingTarget($previous_scaffold_file->
op());
// Remove the previous op so we only touch the destination once.
$message = " - Skip <info>[dest-rel-path]</info>: overridden in <comment>{
$package_name}</comment>";
$this->scaffoldFilesByProject
[$previous_scaffold_file->
packageName()][$destination_rel_path] =
new ScaffoldFileInfo($destination,
new SkipOp($message));
} // If there is NOT already a scaffolding operation happening at this
// path, notify the scaffold operation of this fact.
else { $op =
$op->
scaffoldAtNewLocation($destination);
}