/**
  * Gets the role of a folder.
  *
  * @param FolderInterface $folder Folder object to get the role from
  * @return string The role the folder has
  */
 public function getRole(FolderInterface $folder)
 {
     $folderRole = FolderInterface::ROLE_DEFAULT;
     $identifier = $folder->getIdentifier();
     if (method_exists($this->driver, 'getRole')) {
         $folderRole = $this->driver->getRole($folder->getIdentifier());
     }
     if (isset($this->fileMounts[$identifier])) {
         $folderRole = FolderInterface::ROLE_MOUNT;
         if (!empty($this->fileMounts[$identifier]['read_only'])) {
             $folderRole = FolderInterface::ROLE_READONLY_MOUNT;
         }
         if ($this->fileMounts[$identifier]['user_mount']) {
             $folderRole = FolderInterface::ROLE_USER_MOUNT;
         }
     }
     if ($folder instanceof Folder && $this->isProcessingFolder($folder)) {
         $folderRole = FolderInterface::ROLE_PROCESSING;
     }
     return $folderRole;
 }
 /**
  * Get all folders in root line of given folder
  *
  * @param FolderInterface $folder
  * @return Folder[]
  */
 public function getFolderRootLine(FolderInterface $folder)
 {
     $rootLine = array($folder);
     $parentFolder = $folder->getParentFolder();
     $count = 0;
     while ($parentFolder->getIdentifier() !== $folder->getIdentifier()) {
         $rootLine[] = $parentFolder;
         $count++;
         if ($count > 999) {
             break;
         }
         $folder = $parentFolder;
         $parentFolder = $parentFolder->getParentFolder();
     }
     return array_reverse($rootLine);
 }