forked from projects/file-explorer
@ -20,10 +20,10 @@ class FileSystemService
|
||||
/**
|
||||
* @return DirContent[]
|
||||
*/
|
||||
public function getDirs(): array
|
||||
public function getDirs(string $dirs): array
|
||||
{
|
||||
$finder = new Finder();
|
||||
$finder->in($this->dir);
|
||||
$finder->in($this->dir . '/' . $dirs);
|
||||
|
||||
$contents = [];
|
||||
|
||||
|
23
src/Service/Twig/RoutingService.php
Normal file
23
src/Service/Twig/RoutingService.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Twig;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
class RoutingService
|
||||
{
|
||||
public function __construct(private UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
public function goBack(Request $request): string
|
||||
{
|
||||
$dirsString = $request->attributes->get('dirs', '');
|
||||
$dirs = explode('/', $dirsString);
|
||||
array_pop($dirs);
|
||||
|
||||
return $this->urlGenerator->generate('app_home', ['dirs' => implode('/', $dirs)]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user