chore: code cleanup
This commit is contained in:
1 parent
c4e28818e0
commit
e36009008c
273 files changed
+547
-531
No files matched your search
@@ -11,7 +11,6 @@ use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Filesystem\Exception\IOException;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use function Symfony\Component\String\s;
|
||||
|
||||
class UploadHandler
|
||||
{
|
||||
@@ -22,7 +21,7 @@ class UploadHandler
|
||||
private readonly OrphanageManager $orphanageManager,
|
||||
private readonly Sanitizer $sanitizer,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly string $projectDir
|
||||
private readonly string $projectDir,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -121,11 +120,12 @@ class UploadHandler
|
||||
;
|
||||
}
|
||||
|
||||
public function getUploadFilepath(Upload $upload): string
|
||||
public function getUploadFilepath(Upload $upload, bool $absolute = true): string
|
||||
{
|
||||
$folder = substr($upload->getFilename(), 0, 1);
|
||||
$relativePath = sprintf('uploads/%s/%s/%s', $upload->getType(), $folder, $upload->getFilename());
|
||||
|
||||
return sprintf('%s/uploads/%s/%s/%s', $this->projectDir, $upload->getType(), $folder, $upload->getFilename());
|
||||
return true === $absolute ? sprintf('%s/%s', $this->projectDir, $relativePath) : $relativePath;
|
||||
}
|
||||
|
||||
public function getTempUploadFilepath(UploadDto $uploadDto, string $uploadSessionId): string
|
||||
|
||||
Reference in new issue
Block a user