protected function getDirectoryHash(\SplFileInfo $directory)
{
// prepare the array
$files = new \ArrayObject();
// prepare the array with the file extensions of the files used to build the hash
$extensionsToWatch = $this->getExtensionsToWatch();
// clear the cache
clearstatcache();
// add all files with the found extensions to the array
foreach (glob($directory . '/*.{' . implode(',', $extensionsToWatch) . '}', GLOB_BRACE) as $filename) {
$files->append($filename);
}
// calculate and return the hash value for the array
return md5($files->serialize());
}