Moved attachment related services into their own namespaces.

This commit is contained in:
Jan Böhmer 2019-10-19 23:29:30 +02:00
parent 896299bc4d
commit f5f581293a
3 changed files with 11 additions and 7 deletions

View file

@ -50,7 +50,15 @@ use App\Services\Attachments\AttachmentPathResolver;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class AttachmentHelper /**
* This service contains basic commonly used functions to work with attachments.
* Especially this services gives you important infos about attachments, that can not be retrieved via the entities
* (like filesize or if a file is existing).
*
* Special operations like getting attachment urls or handling file uploading/downloading are in their own services.
* @package App\Services
*/
class AttachmentManager
{ {
protected $pathResolver; protected $pathResolver;
@ -167,8 +175,4 @@ class AttachmentHelper
$factor = (int) floor((strlen($bytes) - 1) / 3); $factor = (int) floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor) . @$sz[$factor]; return sprintf("%.{$decimals}f", $bytes / 1024 ** $factor) . @$sz[$factor];
} }
} }

View file

@ -61,8 +61,8 @@ class AttachmentReverseSearch
/** /**
* Find all attachments that use the given file * Find all attachments that use the given file
* @param File $file * @param \SplFileInfo $file The file for which is searched
* @return Attachment[] * @return Attachment[] An list of attachments that use the given file.
*/ */
public function findAttachmentsByFile(\SplFileInfo $file) : array public function findAttachmentsByFile(\SplFileInfo $file) : array
{ {