/** * Check if directory under given path contains subdirectories * * @param ResourceType $resourceType * @param string $path * * @return bool true if directory contains subdirectories */ public function containsDirectories(ResourceType $resourceType, $path = '') { if (method_exists($this->adapter, 'containsDirectories')) { return $this->adapter->containsDirectories($this, $resourceType, $path, $this->acl); } $directoryPath = $this->buildPath($resourceType, $path); $contents = $this->listContents($directoryPath); foreach ($contents as $entry) { if ($entry['type'] === 'dir' && !$this->isHiddenFolder($entry['basename']) && $this->acl->isAllowed($resourceType->getName(), Path::combine($path, $entry['basename']), Permission::FOLDER_VIEW)) { return true; } } return false; }