Gets all the users albums and returns them as a list of folders
for the file picker

@return mixes $files Array in the format get_listing uses for folders
173520
public function get_albums() {
        $files = array();
        $content = $this->googleoauth->get(self::LIST_ALBUMS_URL);

        try {
            if (strpos($content, '<?xml') !== 0) {
                throw new moodle_exception('invalidxmlresponse');
            }
            $xml = new SimpleXMLElement($content);
        } catch (Exception $e) {
            // An error occured while trying to parse the XML, let's just return nothing. SimpleXML does not
            // return a more specific Exception, that's why the global Exception class is caught here.
            return $files;
        }

        foreach ($xml->entry as $album) {
            $gphoto = $album->children('http://schemas.google.com/photos/2007');

            $mediainfo = $album->children('http://search.yahoo.com/mrss/');
            // Hacky...
            $thumbnailinfo = $mediainfo->group->thumbnail[0]->attributes();

            $files[] = array( 'title' => (string) $album->title,
                'date'  => userdate($gphoto->timestamp),
                'size'  => (int) $gphoto->bytesUsed,
                'path'  => (string) $gphoto->id,
                'thumbnail' => (string) $thumbnailinfo['url'],
                'thumbnail_width' => 160,  // 160 is the native maximum dimension.
                'thumbnail_height' => 160,
                'children' => array(),
            );
        }

        return $files;
    }
1097443
public function getAllDownloads ()
    {
        try
        {
            $directoryIterator = new \DirectoryIterator($this->downloadDir);
            $downloads         = [];

            foreach ($directoryIterator as $file)
            {
                if (!$file->isFile())
                {
                    continue;
                }

                // skip hidden files
                if ("." === $file->getBasename()[0])
                {
                    continue;
                }

                $downloads[$file->getFilename()] = new Download($file, self::RELATIVE_DOWNLOAD_DIR);
            }

            ksort($downloads);
            return $downloads;
        }
        catch (\UnexpectedValueException $e)
        {
            return [];
        }
    }
708257
public function getUsers()
    {
        $userStorage =  $this->entityTypeManager->getStorage('user');
        $users = $userStorage->loadMultiple();

        $userList = [];
        foreach ($users as $userId => $user) {
            $userList[$userId] = $user->getUsername();
        }

        return $userList;
    }
1067393
public function getFiles()
    {
        $files = get_included_files();

        if (class_exists('\O2System\Framework', false)) {
            foreach ($files as $key => $file) {

                if (strpos($file, 'autoload.php') !== false) {
                    unset($files[ $key ]);
                    continue;
                }

                $files[ $key ] = str_replace(PATH_ROOT, DIRECTORY_SEPARATOR, $file);
            }
        }

        return $files;
    }
147247
public function getListingFolders() {
		$folders = imap_list($this->getImapStream(), $this->imapPath, "*");
		foreach ($folders as $key => $folder)
		{
			$folder = str_replace($this->imapPath, "", imap_utf7_decode($folder));
			$folders[$key] = $folder;
		}
		return $folders;
	}
249321
public function getOrderFilesList()
    {
        if ($this->_oOrderFilesList !== null) {
            return $this->_oOrderFilesList;
        }

        $oOrderFileList = oxNew(\OxidEsales\Eshop\Application\Model\OrderFileList::class);
        $oOrderFileList->loadUserFiles($this->getUser()->getId());

        $this->_oOrderFilesList = $this->_prepareForTemplate($oOrderFileList);

        return $this->_oOrderFilesList;
    }
656442
public function getFiles()
    {
        $files = [];
        //import z elementów File
        foreach ($this->getElements() as $element) {
            if (!($element instanceof \Mmi\Form\Element\File)) {
                continue;
            }
            /* @var $element \Mmi\Form\Element\File */
            if (!$element->isUploaded()) {
                continue;
            }
            $files[$element->getName()] = $element->getFiles();
        }
        return $files;
    }
902934
public function fileList()
    {
        $result = array();

        $dirContent = opendir($this->_dirPath);
        while (($file = readdir($dirContent)) !== false) {
            if (($file == '..')||($file == '.')) {   continue;
            }

            if(!is_dir($this->_dirPath . '/' . $file) ) {
                $result[] = $file;
            }
        }
        closedir($dirContent);

        return $result;
    }
1133001
private function getFiles()
    {
        $fieldname = $this->setting['fieldname'];
        if ($fieldname) {
            $_files = isset($_FILES[$fieldname]) ? $_FILES[$fieldname] : array();
            $files  = [$fieldname => $_files];
        } else {
            //all
            $files = $_FILES;
        }
        return $files;
    }
266759
public function get_images() {
        $results = $this->api_call('images.php', array(
            'collection' => $this->get_type()
        ));

        return array_map(function($o) {
            return $this->get_image($o);
        }, $results);
    }
1362045
public function toArray()
    {
        return [
            'folderId' => $this->folder->getId(),
            'usageType' => $this->usageType,
            'usageId' => $this->usageId,
            'status' => $this->status,
        ];
    }
681638
private function getRouteFolders()
    {
        $rotas = \Config\Config::getViewPermissoes();
        $libsPath[] = [DOMINIO => "public/{$this->directory}"];
        if (!empty($_SESSION['userlogin'])) {
            $libsPath[][DOMINIO] = "public/{$this->directory}/{$_SESSION['userlogin']['setor']}";
            $libsPath = array_merge($libsPath, array_map(function ($class) {
                return [$class => VENDOR . $class . "/public/{$this->directory}/{$_SESSION['userlogin']['setor']}"];
            }, $rotas));
        }
        $libsPath = array_merge($libsPath, array_map(function ($class) {
            return [$class => VENDOR . $class . "/public/{$this->directory}"];
        }, $rotas));

        return $libsPath;
    }
715026
protected function files() : Collection
	{
		$storing = $this->pictures->get('storing');

		return $this->normalizeBag(
			is_array($storing) ? $storing : [$storing]
		);
	}
101425
public function list_files() {
        $this->listresults = array();
        $this->mode = self::MODE_LIST;
        $this->extract_or_list();
        $listresults = $this->listresults;
        $this->listresults = null;
        return $listresults;
    }
355471
public function dirs()
    {
        $filesList = array_filter($this->items, function($item) {
            return ($item['instance'] instanceof DirectoryInterface);
        });

        $filesList = array_map(function($item) {
            return $item['instance'];
        }, $filesList);

        return new Collection($filesList);
    }
940063
public function getList()
    {
        $list = glob($this->basePath . "/*.md");
        foreach ($list as $key=>$item) {
            $item = pathinfo($item);
            $item = $item['filename'];
            $item = preg_split("/^[\d-]+/", $item, 2, PREG_SPLIT_NO_EMPTY);
            $list[$key] = ucfirst(str_replace('-',' ',$item[0]));
        }

        return $list;
    }
1263912
public function all()
    {
        $list = [];

        /** @var UniformResourceLocator $locator */
        $locator = $this->grav['locator'];

        $iterator = $locator->getIterator('themes://');

        /** @var \DirectoryIterator $directory */
        foreach ($iterator as $directory) {
            if (!$directory->isDir() || $directory->isDot()) {
                continue;
            }

            $theme = $directory->getFilename();
            $result = $this->get($theme);

            if ($result) {
                $list[$theme] = $result;
            }
        }
        ksort($list);

        return $list;
    }