src/Controller/FormController.php
public function localPathFoldersAction(Request $request)
    {
        $form = $this->createForm(new ChoiceLocalPath());
        $form->handleRequest($request);
        $path = $form->get('path')->getData() ?: Filesystem::getUserHomeDir();

        if (($root = $request->get('root')) && strpos($path, $root) !== 0) {
            $path = $root;
        }

        /* @var $response JsonResponse */
        $response = $this->getCacheTimeKeeper()
            ->getResponse([(new \DateTime())->setTimestamp(filemtime($path))], -1, new JsonResponse());
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        return $response->setData([
            'path' => $path,
            'folders' => Filesystem::scandir($path, Filesystem::DIRECTORY),
        ]);
    }
public function localPathFoldersAction(Request $request)
    {
        $form = $this->createForm(new ChoiceLocalPath());
        $form->handleRequest($request);
        $path = $form->get('path')->getData() ?: Filesystem::getUserHomeDir();

        if (($root = $request->get('root')) && strpos($path, $root) !== 0) {
            $path = $root;
        }

        /* @var $response JsonResponse */
        $response = $this->getCacheTimeKeeper()
            ->getResponse([(new \DateTime())->setTimestamp(filemtime($path))], -1, new JsonResponse());
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        return $response->setData([
            'path' => $path,
            'folders' => Filesystem::scandir($path, Filesystem::DIRECTORY),
        ]);
    }
public function localPathFoldersAction ( Request $ request ) { $ form = $ this -> createForm ( new ChoiceLocalPath ( ) ) ; $ form -> handleRequest ( $ request ) ; $ path = $ form -> get ( 'path' ) -> getData ( ) ? : Filesystem :: getUserHomeDir ( ) ; if ( ( $ root = $ request -> get ( 'root' ) ) && strpos ( $ path , $ root ) !== 0 ) { $ path = $ root ; } /* @var $response JsonResponse */ $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( [ ( new \ DateTime ( ) ) -> setTimestamp ( filemtime ( $ path ) ) ] , - 1 , new JsonResponse ( ) ) ; // response was not modified for this request if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } return $ response -> setData ( [ 'path' => $ path , 'folders' => Filesystem :: scandir ( $ path , Filesystem :: DIRECTORY ) , ] ) ; }
Return list folders for path.

@param Request $request

@return JsonResponse
Return list folders for path .