public function __construct(array $paths)
{
//Filter out the files, the Finder class can not handle files in the ->in() call.
$files = array_filter($paths, function ($possible_file) {
return is_file($possible_file);
});
//Filter out the directories to be used for searching using the Filter class.
$dirs = array_filter($paths, function ($possible_dir) {
return is_dir($possible_dir);
});
$finder = new Finder();
//Add the given 'stand-alone-files'
$finder->append($files);
//Add the Directores recursively
$finder = $finder->in($dirs);
//Filter out non readable files
$finder = $finder->filter(function (SplFileInfo $finder) {
return $finder->isReadable();
});
//Loop through all the files and save the latest modification time.
foreach ($finder->files() as $file) {
/*@var $file \SplFileInfo */
if ($this->modification_time < $file->getMTime()) {
$this->modification_time = $file->getMTime();
}
}
}