private function filterExisting($driver, array $files)
{
$newFiles = [];
foreach ($files as $file) {
// by this point the last 4 chatacters of the filename
// will be ".xml", so we strip them off and rest MUST
// be the identifier.
$identifier = substr($file->getFilename(), 0, -4);
// if the driver already has the given identifier, then
// skip it.
if ($driver->has($identifier)) {
continue;
}
$newFiles[] = $file;
}
return $newFiles;
}