Bolt\Controller\Async\FilesystemManager::browse PHP Метод

browse() публичный Метод

List browse on the server, so we can insert them in the file input.
public browse ( Request $request, string $namespace, string $path ) : TemplateResponse
$request Symfony\Component\HttpFoundation\Request
$namespace string
$path string
Результат Bolt\Response\TemplateResponse
    public function browse(Request $request, $namespace, $path)
    {
        $directory = $this->filesystem()->getDir("{$namespace}://{$path}");
        try {
            $it = $directory->getContents();
        } catch (IOException $e) {
            $msg = Trans::__('page.file-management.message.folder-not-found', ['%s' => $path]);
            $this->logException($msg, $e);
            $this->flashes()->error($msg);
            $it = [];
        }
        $files = array_filter($it, function (HandlerInterface $handler) {
            return $handler->isFile();
        });
        $directories = array_filter($it, function (HandlerInterface $handler) {
            return $handler->isDir();
        });
        $context = ['directory' => $directory, 'files' => $files, 'directories' => $directories, 'multiselect' => $request->query->getBoolean('multiselect')];
        return $this->render('@bolt/async/browse.twig', ['context' => $context], ['title', Trans::__('page.file-management.message.files-in', ['%s' => $path])]);
    }