private function flushDirectory(DirectoryInterface $directory)
{
if (!$directory->exists()) {
return;
}
$files = $directory->find()->ignoreDotFiles()->ignoreVCS();
/** @var HandlerInterface $file */
foreach ($files as $file) {
try {
$file->delete();
} catch (IOException $e) {
}
}
}