/** * Lists the subdirectories inside a directory * * @param null|string $dir The directory to scan. Skip to use the current directory. * * @return array|bool A list of folders, or false if we could not get a listing * * @throws \RuntimeException When the server is incompatible with our folder scanner */ public function listFolders($dir = null) { try { // First try using a direct access $list = $this->fileAdapter->listFolders($dir); } catch (\RuntimeException $e) { if (!is_object($this->abstractionAdapter)) { // If we failed and there is no abstraction adapter rethrow the exception throw $e; } else { // Also try using the abstraction adapter $list = $this->abstractionAdapter->listFolders($dir); } } return $list; }