/**
  * checks if given directory is part of the excluded directory list.
  *
  * @param string $dir
  *
  * @return bool
  */
 private function isDirectoryExcluded($dir)
 {
     foreach ($this->directoryExcludes as $excluded) {
         if ($this->filesystem->realpath($this->root . DIRECTORY_SEPARATOR . $excluded) === $this->filesystem->realpath($dir)) {
             return true;
         }
     }
     return false;
 }