class Storage

Class Storage

Properties

protected FileRepository $repo file repository instance
protected FilesystemHandler $files filesystem handler instance
protected GuardInterface $auth Authenticator instance
protected Keygen $keygen key generator instance
protected Distributor $distributor distributor instance
protected TempFileCreator $tempFiles temporary file creator instance
protected ResponseFactory $response ResponseFactory instance

Methods

__construct(FileRepository $repo, FilesystemHandler $files, GuardInterface $auth, Keygen $keygen, Distributor $distributor, TempFileCreator $tempFiles, ResponseFactory $response)

constructor

upload(UploadedFile $uploaded, string $path, string|null $name = null, string|null $disk = null, UserInterface $user = null)

file upload to storage

create(string $content, string $path, string $name, string|null $disk = null, string|null $originId = null, UserInterface $user = null)

create file

BinaryFileResponse
download(File $file, string|null $name = null)

file download from storage

bool
delete(File $file)

delete file

bool
remove(File $file)

delete file. alias for delete

void
bind(string $fileableId, File $file)

set the target be have a file

bool
has(string $fileableId, File $file)

has

void
unBind(string $fileableId, File $file, bool $remove = false)

set the target be not have a file

void
unBindAll(string $fileableId, bool $remove = false)

unset all fileable's files to fileable

void
sync(string $fileableId, array $fileIds = array())

Sync fileable's files to fileable

string
makePath(string $id, string $path)

make path name

string
makeFilename(string $clientname)

make file name

getFilesystemHandler()

file system handler instance

getDistributor()

distributor instance

void
setDistributor(Distributor $distributor)

set distributor instance

getTempFileCreator()

Returns the TempFileCreator instance

mixed
__call(string $name, array $arguments)

__call

Details

at line 98
__construct(FileRepository $repo, FilesystemHandler $files, GuardInterface $auth, Keygen $keygen, Distributor $distributor, TempFileCreator $tempFiles, ResponseFactory $response)

constructor

Parameters

FileRepository $repo file repository instance
FilesystemHandler $files filesystem handler instance
GuardInterface $auth Authenticator instance
Keygen $keygen key generator instance
Distributor $distributor distributor instance
TempFileCreator $tempFiles temporary file creator instance
ResponseFactory $response ResponseFactory instance

at line 126
File upload(UploadedFile $uploaded, string $path, string|null $name = null, string|null $disk = null, UserInterface $user = null)

file upload to storage

Parameters

UploadedFile $uploaded uploaded file instance
string $path be saved path
string|null $name be saved file name
string|null $disk disk name (ex. local, ftp, s3 ...)
UserInterface $user user instance

Return Value

File

at line 180
File create(string $content, string $path, string $name, string|null $disk = null, string|null $originId = null, UserInterface $user = null)

create file

Parameters

string $content file content
string $path directory for saved
string $name saved name
string|null $disk disk for saved
string|null $originId original file id
UserInterface $user user instance

Return Value

File

at line 217
BinaryFileResponse download(File $file, string|null $name = null)

file download from storage

Parameters

File $file file instance
string|null $name name of be downloaded file

Return Value

BinaryFileResponse

Exceptions

FileDoesNotExistException

at line 247
bool delete(File $file)

delete file

Parameters

File $file file instance

Return Value

bool

at line 270
bool remove(File $file)

delete file. alias for delete

Parameters

File $file file instance

Return Value

bool

at line 282
void bind(string $fileableId, File $file)

set the target be have a file

Parameters

string $fileableId fileable identifier
File $file file instance

Return Value

void

at line 300
bool has(string $fileableId, File $file)

has

Parameters

string $fileableId fileable identifier
File $file file instance

Return Value

bool

at line 316
void unBind(string $fileableId, File $file, bool $remove = false)

set the target be not have a file

Parameters

string $fileableId fileable identifier
File $file file instance
bool $remove remove file when given true

Return Value

void

at line 337
void unBindAll(string $fileableId, bool $remove = false)

unset all fileable's files to fileable

Parameters

string $fileableId fileable identifier
bool $remove remove file when given true

Return Value

void

at line 353
void sync(string $fileableId, array $fileIds = array())

Sync fileable's files to fileable

Parameters

string $fileableId fileable identifier
array $fileIds file identifier

Return Value

void

at line 380
private string makePath(string $id, string $path)

make path name

Parameters

string $id identifier
string $path directory path

Return Value

string

at line 397
private string makeFilename(string $clientname)

make file name

Parameters

string $clientname client original file name

Return Value

string

at line 407
FilesystemHandler getFilesystemHandler()

file system handler instance

Return Value

FilesystemHandler

at line 417
Distributor getDistributor()

distributor instance

Return Value

Distributor

at line 428
void setDistributor(Distributor $distributor)

set distributor instance

Parameters

Distributor $distributor distributor instance

Return Value

void

at line 438
TempFileCreator getTempFileCreator()

Returns the TempFileCreator instance

Return Value

TempFileCreator

at line 450
mixed __call(string $name, array $arguments)

__call

Parameters

string $name method name
array $arguments arguments

Return Value

mixed